Netdata Community

Using Netdata behind a Go Reverse Proxy

Hi,

Trying to integrate Netdata inside a Go application using a reverse proxy.

But i get a lot ot 404 Not found for the static files, do you have any ideas how to get this to work?
I’ve tried modifying the path on the request but no luck.

Following the guide at:

okt 20 07:48:40 poc [16466]: [GIN] 2020/10/20 - 07:48:40 | 200 | 3.451652ms | ::1 | GET “/netdata/”
okt 20 07:48:40 poc [16466]: [GIN] 2020/10/20 - 07:48:40 | 404 | 59.437µs | ::1 | GET “/netdata/static/css/2.4fcfa1d7.chunk.css”
okt 20 07:48:40 poc [16466]: [GIN] 2020/10/20 - 07:48:40 | 404 | 7.519µs | ::1 | GET “/netdata/static/css/main.55d36738.chunk.css”
okt 20 07:48:40 poc [16466]: [GIN] 2020/10/20 - 07:48:40 | 404 | 4.486µs | ::1 | GET “/netdata/images/netdata-logomark.svg”
okt 20 07:48:40 poc [16466]: [GIN] 2020/10/20 - 07:48:40 | 404 | 4.089µs | ::1 | GET “/netdata/dashboard-react.js”
okt 20 07:48:40 poc [16466]: [GIN] 2020/10/20 - 07:48:40 | 404 | 3.862µs | ::1 | GET “/netdata/static/js/main.5d949251.chunk.js”
okt 20 07:48:40 poc [16466]: [GIN] 2020/10/20 - 07:48:40 | 404 | 4.07µs | ::1 | GET “/netdata/static/js/2.20233c1e.chunk.js”
okt 20 07:48:40 poc [16466]: [GIN] 2020/10/20 - 07:48:40 | 404 | 7.755µs | ::1 | GET “/netdata/dashboard-react.js”
okt 20 07:48:41 poc [16466]: [GIN] 2020/10/20 - 07:48:41 | 404 | 9.675µs | ::1 | GET “/netdata/static/js/2.20233c1e.chunk.js”
okt 20 07:48:41 poc [16466]: [GIN] 2020/10/20 - 07:48:41 | 404 | 6.3µs | ::1 | GET “/netdata/static/js/main.5d949251.chunk.js”

This is inspired by the guide at https://learn.netdata.cloud/docs/agent/running-behind-apache but we would like to use a Go application instead.

Hello @glesys-andreas ,

I never use gin to develop, but I will give you some additional information that probably can help you.

When users do request for Netdata dashboard, it will give a basic index that will request additional files, this explains the css and js information you are seeing. You can check all requests to Netdata using the log /var/log/netdata/access.log. I think this will help you to confirm that Netdata received the requests that you are sending.

Finally depending of Netdata configuration, it can also gives message like 301, that will indicate an internal redirect.

Best regards!

Hi again!

I don’t know if i’m any closer to a solution, using a wildcard in the handler i dont get any 404 any more.
Example
r.GET("/netdata/*anypath", netdataProxy)
But now every path is tranlated to /netdata/ index page
For example /netdata/static/css/2.4fcfa1d7.chunk.css is translated to the index “/”…