Support WebUI behind reverse proxy as subfolder

Issue #1101 closed
patschi created an issue

I have my mailpiler installation running in my internal network, without direct access from outside. For easy web-only-access I’d like to access the web-ui using mail.domain.tld/archive/. As unfortunately parts of the WebUI are using absolute URLs, it’s not easy possible to reverse-proxy the webUI from a subfolder.

I was trying to workaround it with, however without success:

location ^~ /archive/ {
    rewrite ^/archive/(.*) /\$1 break;
    proxy_set_header Accept-Encoding ""; # required to get sub_filter to work
    sub_filter '<head>' '<head>\n    <base href="/archive/">';
    sub_filter '/view' 'view';
    sub_filter_once off;
    sub_filter_last_modified on;

    proxy_http_version 1.1;
    proxy_set_header X-Real-IP         \$remote_addr;
    proxy_set_header X-Forwarded-For   \$proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto \$scheme;
    proxy_set_header Connection        "";

    proxy_read_timeout                 900;
    proxy_buffers 32 4k;
    proxy_pass https://$PILER_DOMAIN;
}

Are there any plans to use relative URLs to be able to reverse-proxy under a subfolder?

Comments (3)

  1. Janos SUTO repo owner

    Well, the idea is to get a dedicated virtual host for the gui, that’s why everything uses an absolute url at the moment. Did you try proxying outside.domain.com to inside.domain.com? It should work with nginx as well.

  2. patschi reporter

    Sorry for the delayed reply! Reverse proxy of subdomains works out, however it might be easier for my specific setup to have it working under a subfolder. I can live with a dedicated subdomain as well. Thanks anyway!

  3. Log in to comment