Search code examples
profilinggrafananginx-reverse-proxy

Grafana with Pyroscope behind nginx on remotehost : 405 not allowed


setup:

host A: pyroscope on localhost:4040 behind nginx-reverse-proxy with the following section in nginx.conf:

    location /pyroscope {
        proxy_pass http://localhost:4040;

        # dav_methods  PUT;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

host B: grafana-server which should send requests to pyroscope

Question

What am i missing or doing wrong or what can i test further? I'm confused because testing with curl seems to work...

I tried to add datasource with this results:

from ui

I'm trying to add pyroscope as datasource to grafana as http://ip/pyroscope, but if I click save & test it returns: 405 not allowed

from commandline via curl

curl http://ip/pyroscope

StatusCode        : 200
StatusDescription : OK
Content           : <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible"
                    content="IE=edge,chrome=1"/><meta name="viewport" content="width=device-width"/><meta
                    name="theme-color" ...
RawContent        : HTTP/1.1 200 OK
                    Connection: keep-alive
                    Vary: Accept-Encoding
                    Content-Length: 498
                    Content-Type: text/html
                    Date: Wed, 17 Jan 2024 11:53:48 GMT
                    Server: nginx/1.22.0

                    <!doctype html><html lang="en...
Forms             : {}
Headers           : {[Connection, keep-alive], [Vary, Accept-Encoding], [Content-Length, 498], [Content-Type,
                    text/html]...}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : mshtml.HTMLDocumentClass
RawContentLength  : 498

Solution

  • I missed a trailing slash at grafana-source.

    Grafana-UI, Source: http://ip/pyroscope/

    Even though I'm confused why I got an http-405, its working.