GithubHelp home page GithubHelp logo

Comments (1)

slaxor505 avatar slaxor505 commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.