Comments (1)
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.
def get_quoted_path(self, path):
"""Return quoted path to be used in proxied request"""
return quote(path.encode('utf8'), QUOTE_SAFE)
The log after the fix:
django-log [2023-01-02 07:09:52 UTC] INFO views ProxyView created
django-log [2023-01-02 07:09:52 UTC] DEBUG views Dispatch full path: /grafana/api/datasources/proxy/2/plant/detail/abelia%20dielsii/
django-log [2023-01-02 07:09:52 UTC] DEBUG views Request headers: {'Content-Type': 'text/plain', 'Authorization': 'Basic YWRtaW46YWRtaW4=', 'User-Agent': 'curl/7.79.1', 'Accept': '/'}
django-log [2023-01-02 07:09:52 UTC] DEBUG views Request URL: http://localhost:3000/api/datasources/proxy/2/plant/detail/abelia dielsii/
django-log [2023-01-02 07:09:52 UTC] DEBUG connectionpool Starting new HTTP connection (1): localhost:3000
django-log [2023-01-02 07:09:52 UTC] DEBUG connectionpool http://localhost:3000 "GET /api/datasources/proxy/2/plant/detail/abelia%20dielsii/ HTTP/1.1" 200 409
django-log [2023-01-02 07:09:52 UTC] DEBUG views Proxy response header: HTTPHeaderDict({'Allow': 'GET, HEAD, OPTIONS', 'Content-Length': '409', 'Content-Security-Policy': 'sandbox', 'Content-Type': 'application/json', 'Date': 'Mon, 02 Jan 2023 07:09:52 GMT', 'Referrer-Policy': 'same-origin', 'Vary': 'Accept, Cookie, Origin', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'deny', 'X-Xss-Protection': '1; mode=block'})
django-log [2023-01-02 07:09:52 UTC] DEBUG response Proxy response headers: HTTPHeaderDict({'Allow': 'GET, HEAD, OPTIONS', 'Content-Length': '409', 'Content-Security-Policy': 'sandbox', 'Content-Type': 'application/json', 'Date': 'Mon, 02 Jan 2023 07:09:52 GMT', 'Referrer-Policy': 'same-origin', 'Vary': 'Accept, Cookie, Origin', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'deny', 'X-Xss-Protection': '1; mode=block'})
django-log [2023-01-02 07:09:52 UTC] DEBUG response Content-Type: application/json
django-log [2023-01-02 07:09:52 UTC] INFO response Normalizing response headers
django-log [2023-01-02 07:09:52 UTC] DEBUG utils Response headers: {'Content-Type': 'application/json', 'Allow': 'GET, HEAD, OPTIONS', 'Content-Length': '409', 'Content-Security-Policy': 'sandbox', 'Date': 'Mon, 02 Jan 2023 07:09:52 GMT', 'Referrer-Policy': 'same-origin', 'Vary': 'Accept, Cookie, Origin', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'deny', 'X-Xss-Protection': '1; mode=block'}
django-log [2023-01-02 07:09:52 UTC] INFO response Checking for invalid cookies
django-log [2023-01-02 07:09:52 UTC] DEBUG response Response cookies:
django-log [2023-01-02 07:09:52 UTC] DEBUG views RESPONSE RETURNED: <HttpResponse status_code=200, "application/json">
from django-revproxy.
Related Issues (20)
- Release 0.10.0 as old version does not allow urllib3 > 1.17 HOT 1
- django authentication and permissions HOT 1
- Add ability to not stream big response or at least override MIN_STREAMING_LENGTH HOT 1
- Websocket Proxying Support (Django Channels) HOT 4
- How to set upstream to same server HOT 2
- Broken image on pypi page HOT 1
- AttributeError: 'HttpResponse' object has no attribute '_headers' HOT 22
- Implement Jazzband guidelines for django-revproxy HOT 24
- Is there any equivalent of this package for Flask? HOT 1
- Question regarding path - Maybe stupid, but I would need some help HOT 3
- Grafana 403
- When will the fix for django 3.2 be released? HOT 38
- Fix compatibility for python 3.10 HOT 1
- Random subdomain as upstream or multi upstream domain support
- ModuleNotFoundError: No module named 'kerberosrevproxy' HOT 1
- Incorrect handling of "max-age" attribute of HTTP Cookie HOT 1
- quickstart is missing some examples HOT 2
- Emitting original path HOT 2
- Deprecation warning for `urllib` on Python 3.11 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-revproxy.