Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4723

Styling fails when proxying with path

$
0
0

@john wrote:

I’m trying to document the correct way to proxy to netdata with haproxy, on 127.0.0.1:19999. The problem I’m having is - only when running with a path - the styling fails. I assume I have to do something to rewrite the path, I’m not sure how to translate the known working configuration from nginx to haproxy.

The accepted nginx configuration is:

upstream netdata {
    # the Netdata server
    server 127.0.0.1:19999;
    keepalive 64;
}

server {
    listen 81;
    # the virtual host name of this subfolder should be exposed
    server_name netdata.domain.tld;

       location = /netdata {
                return 301 /netdata/;
        }

        location ~ /netdata/(?<ndpath>.*) {
                proxy_redirect off;
                proxy_set_header Host $host;

                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;
                proxy_pass_request_headers on;
                proxy_http_version 1.1;
                proxy_set_header Connection "keep-alive";
                proxy_store off;
                proxy_pass http://netdata/$ndpath$is_args$args;
        }
}

The configuration I’ve tried using is:

frontend http_frontend
    ## HTTP ipv4 and ipv6 on all ips ##
    bind :::80 v4v6
    # URL begins with /netdata
    acl is_netdata url_beg  /netdata
    ## Backends ##
    use_backend     netdata_backend       if is_netdata
    # Other requests go here (optional)
    default_backend www_backend

backend netdata_backend
    option forwardfor
    server      netdata_local     127.0.0.1:19999
    http-request set-header Host %[src]
    http-request set-header X-Forwarded-For %[src]
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request set-header Connection "keep-alive"

I tried using a rewrite to remove the sub path but wasn’t able to get it to work. Is there a equivalent configuration I should be using to the nginx configuration to get the styling working?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4723

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>