-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Proxy replaces space encoded as %20 with + #159
Comments
Looking further it seems that the revproxy uses "quote_plus()" from urllib while it may need to use "quote()" instead or at least for non-form requests. Changing the above works fine.
The log after the fix: django-log [2023-01-02 07:09:52 UTC] INFO views ProxyView created |
jazzband#159 Proxy replaces space encoded as %20 with + jazzband#159
Sorry for the late response. I've opened #191 which should fix this issue. |
Hi @slaxor505 @qx, A new |
Hi there,
I'm hosting Grafana behind this revproxy and it seems to be replacing %20 in the URL with "+" which causes 404 on Grafana API backend.
E.g:
curl http://admin:admin@localhost:8000/grafana/api/datasources/proxy/2/plant/detail/abelia%20dielsii/
Makes the following request to the upstream:
http://localhost:3000/api/datasources/proxy/2/plant/detail/abelia+dielsii/
Is it bug or is it configurable or is it something I'm missing?
Django log:
[2023-01-02 06:01:47 UTC] INFO views ProxyView created
[2023-01-02 06:01:47 UTC] DEBUG views Dispatch full path: /grafana/api/datasources/proxy/2/plant/detail/abelia%20dielsii/
[2023-01-02 06:01:47 UTC] DEBUG views Request headers: {'Content-Type': 'text/plain', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:108.0) Gecko/20100101 Firefox/108.0', 'Accept': 'application/json, text/plain, /', 'Accept-Language': 'en-US,en;q=0.5', 'Referer': 'http://localhost:8000/grafana/d/Vba7ZB44k/open-plantbook?orgId=1', 'X-Grafana-Org-Id': '1', 'Dnt': '1', 'Connection': 'keep-alive', 'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Site': 'same-origin', 'Sec-Gpc': '1', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache'}
[2023-01-02 06:01:47 UTC] DEBUG views Request URL: http://localhost:3000/api/datasources/proxy/2/plant/detail/abelia+dielsii/
Thanks in advance!
Update:
I've taken look into source code and I see that:
def quote_plus(string, safe='', encoding=None, errors=None):
in parse.py
causes this. I don't think this is right behaviour as + is only accepted for application/x-www-form-urlencoded that uses + instead of %20 for spaces). I'd expect that the URL's path should be mapped 1-to-1 to backend call.
The text was updated successfully, but these errors were encountered: