Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in redirect urls #186

Open
Pallav-552 opened this issue Mar 15, 2024 · 1 comment
Open

Issue in redirect urls #186

Pallav-552 opened this issue Mar 15, 2024 · 1 comment

Comments

@Pallav-552
Copy link

In my django app my base url is --> htps://api.abc.in/api_app/
I have written a rule in urls.py
re_path(r'^grafana(?P.*)', TestProxyView.TestProxyView.as_view()),

as per above rule when I hit htps://api.abc.in/api_app/grafana it redirect via proxy to my proxy server correctly.
my Proxyview implementation:

from revproxy.views import ProxyView
from revproxy.utils import normalize_request_headers


class TestProxyView(ProxyView):
    upstream = 'https://grafana.com'

now when subsequent calls are getting redirect its going to
hhtps://api.abc.in/grafana/abc.js but ideally I want it htps://api.abc.in/api_app/grafana/abc.js

Any help will be appreciated.

@andruten
Copy link
Member

Hi @Pallav-552! Thanks for posting the issue.
Are you using django templates and it's url template builtin? It should return all urls formatted properly. Anyway, in the example you mentioned, I think you should use static instead so, in a productive environment django shouldn't serve that static files and the proxy will have no effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants