Skip to content

Instantly share code, notes, and snippets.

dec1985 /
Created April 6, 2018 08:13 — forked from JustinTArthur/
A Django 1.4+ view function that acts as a reverse proxy. Great for testing locally or for using as a starting point to code that needs to cache or manipulate the proxied response. If one needs to proxy in production without any response manipulation, performing this in the web container (like nginx or apache) would be recommended instead of thi…
from django.views.decorators.csrf import csrf_exempt
def reverse_proxy(request):
Reverse proxy for a remote service.
path = request.get_full_path()
#Optionally, rewrite the path to fit whatever service we're proxying to.