apache / hertzbeat

Apache HertzBeat(incubating) is a real-time monitoring system with agentless, performance cluster, prometheus-compatible, custom monitoring and status page building capabilities.
https://hertzbeat.apache.org/
Apache License 2.0
5.35k stars 933 forks source link

[Question] support deploy behind a proxy like nginx ? #1055

Open nickycheng opened 1 year ago

nickycheng commented 1 year ago

Question

does hertzbeat support deploy behind a proxy like nginx ?

I tried it, if the contextpath is added, the application cannot be used normally, and the resource paths are all wrong

maybe we can add a server.basePath configuration like kibana?

server.basePath: Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests to Kibana. This setting cannot end in a slash (/).

tomsun28 commented 1 year ago

hi, hertzbeat support deploy behind a proxy like nginx.

maybe we can add a server.basePath configuration like kibana?

maybe you can try config the application.yml file

server:
  port: 1157
  servlet:
    context-path: /demo
gcdd1993 commented 1 year ago

如果在网关层自定义context path,可以使用rewrite移除自定义的路径前缀,例如

location ^~ /hertzbeat {
    rewrite ^/hertzbeat/(.*)$ /$1 break;
    proxy_pass http://hertzbeat;
}
hertzbeat commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


If you customize the context path at the gateway layer, you can use rewrite to remove the custom path prefix, for example

location ^~ /hertzbeat {
rewrite ^/hertzbeat/(.*)$ /$1 break;
proxy_pass http://hertzbeat;
}
Xcyq commented 1 year ago

I have tried to use this config:

location ^~ /hertzbeat {
    rewrite ^/hertzbeat/(.*)$ /$1 break;
    proxy_pass http://hertzbeat;
}

Then I can get js code when I directly request the /hertzbeat/xxx.js: image

But I find that front-end static resources are directly spliced behind the domain? image

So this background is not available. 😥

version: docker image (latest)