muety/mailwhale

Allow to run under subpath with reverse proxy

riaanp78 opened this issue · 6 comments

Love this project! trying to setup a reverse proxy using sub directory. Was wondering if mailwhale supports it?

This is the config I am using:

    location /mailwhale/ {
        proxy_pass http://127.0.0.1:3005;
        proxy_set_header Host iot.rplab.xyz;
        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;

    }

Any hints?

muety commented

Looks about right. What specific errors are you getting with that config?

no errors. everything starts up fine. I can access it directly from it's port (works) , but via reverse proxy I get a blank page

image

Using webconsole it looks like it is trying to load files from the root file system e.g. / instead of /mailwhale/

muety commented

I think I'll have to implement a few tweaks to support being reverse-proxied under a subpath. Probably similar to this:

https://github.com/muety/wakapi/blob/master/views/head.tpl.html

https://github.com/muety/wakapi/blob/master/routes/routes.go#L47

https://github.com/muety/wakapi/blob/master/config/config.go#L124

I'll keep you posted.

Thank you! Not strictly required, but great if it could.

muety commented

Added support for running behind reverse proxy under a subpath ✔️ Check README for instructions.

Thank you so much. Will check it out