kekskurse / go-mail-admin

HTTP-Interface with a small GUI for a Mailserver
GNU General Public License v3.0
32 stars 5 forks source link

Add subfolder support (feature request) #10

Closed TheVaan closed 4 years ago

TheVaan commented 4 years ago

Hi,

I'm using Go Mail Admin with a nginx reverse proxy. I don't want create a subdomain, instead I want to use a subfolder-style for the Web GUI so I configured the proxy like this:

location /subfolder/ {
    proxy_pass http://localhost:3001/;
    proxy_set_header Host $host/subfolder;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

The website loads, but I cant reach the API, because it doesn't use Host from header but calling directly /api and this kills the subfolder. Would it be possible to add an optional environment variable like GOMAILADMIN_HOST: / (default) what can be configured to GOMAILADMIN_HOST: /subfolder and the var is added to the api url?

Best regards

kekskurse commented 4 years ago

The API Url from the frontend is currently set in the build step of the project. It would be possible to change it and rebuild the frontend (and after it the go projekt) with another url.

I think it would be possible to make it dynamic, that the frontend get the backend url from something like

window.location.href.substr(0,  window.location.href.indexOf("#"))

i will setup a nginx proxy to test if it will work with a subfolder.

kekskurse commented 4 years ago

I try it locale with the following nginx proxy settinges

    location /subfolder/ {
        proxy_pass http://localhost:3001/;
        proxy_set_header Host $host;
    }

It seems to work now, i will test a bit more and if no further issues appear I will close this issue and it will work in the next release.

TheVaan commented 4 years ago

Great!