I need to get rid of squirrelmail/
part from path that's user see.
My .conf
:
location / {
rewrite /squirrelmail/(.*) /$1 last;
proxy_pass https://internal.domain.tld:8081/squirrelmail/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
}
I expect that's my app available for users at root path /
, instead of constantly adding squirrelmail/
to end user path.
So when user goes to https://mail.domain.tld
it properly proxy pass actual app located at https://internal.domain.tld:8081/squirrelmail/
without adding squirrelmail/
to users path (e.g. https://mail.domain.tld/squirrelmail/
)
UPD:
Without rewrite, after user goes to https://mail.domain.tld
it adds squirrelmail/
part to the following requests (like navigate to another tab, open mail and etc.) by application, so for user it now look like https://mail.domain.tld/squirrelmail/?some=params
but for application it now https://internal.domain.tld:8081/squirrelmail/squirrelmail/?some=params
which cause HTTP 404
.