'Django middleware to check ios/android app version using request header

I have an app for both Android and iOS platforms which their backend is written with Django and Django-rest-framework . I've been asked to check header of requests are sent from Android/iOS apps which includes app version number and it should respond if it needs require to update the app or not. Because I have to check this for each request before it reaches the views, I guess I have to do it with the help of a middleware. Is there any middleware already written for this? Otherwise, how can I make a custom middleware for this purpose?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source