You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And of course, I need this to work for whatever domain/server the app is installed on.
The example in the docs only shows redirecting to a static alternate domain (upstream='http://example.com/'). What to I set "upstream" to in order to use whatever server the original request was made to, instead of always going to example.com?
The text was updated successfully, but these errors were encountered:
I have not tested this, but if you create a view that extends ProxyView like this, it should allow you to set the upstream URL to whatever is passed in the url GET parameter.
from revproxy.views import ProxyView
from django.http import HttpResponse
class MyProxyView(ProxyView):
def get(self, request):
self.upstream = request.GET.get('upstream')
return HttpResponse(revproxy.response)
@otuoma Thanks. I have tried setting "upstream" from code, and it works if I set it to just a host, like http://www.mysite.com/, but if I add anything else at the end of the URL, like in my example www.mysite.com/bar/, then I get an exception:
AttributeError: 'MyProxyView' object has no attribute '_parsed_url'
For my use case, I definitely need to have the additional part to the path.
I want to set up a reverse proxy that will redirect a Django app URL to another part of the same website that is outside of Django.
(for example):
www.mysite.com/MyDjangoApp/foo/ -> www.mysite.com/bar/
And of course, I need this to work for whatever domain/server the app is installed on.
The example in the docs only shows redirecting to a static alternate domain (upstream='http://example.com/'). What to I set "upstream" to in order to use whatever server the original request was made to, instead of always going to example.com?
The text was updated successfully, but these errors were encountered: