How does it work?


At a high level, this is what happens behind the scenes in a request proxied by django-revproxy:

  1. Django receives a request from the client and process it using a view that extends revproxy.proxy.ProxyView.

  2. Revproxy will clone the client request.

  3. If the user is authenticated in Django and add_remote_user attribute is set to True the HTTP header REMOTE_USER will be set with request.user.username.

  4. If the add_x_forwarded attribute is set to True the HTTP headers X-Forwarded-For and X-Forwarded-Proto will be set to the IP address of the requestor and the protocol (http or https), respectively.

  5. The cloned request is sent to the upstream server (set in the view).

  6. After receiving the response from upstream, the view will process it to make sure all headers are set properly. Some headers like Location are treated as special cases.

  7. The response received from the upstream server is transformed into a django.http.HttpResponse. For binary files StreamingHttpResponse is used instead to reduce memory usage.

  8. If the user has setted a set of diazo rules and a theme template, a diazo/XSLT transformation will be applied on the response body.

  9. Finally, the response will then be returned to the user