linagora / tmail-flutter

A multi-platform (Flutter) application for reading your emails, with your favorite devices, using the JMAP protocol!
GNU Affero General Public License v3.0
309 stars 69 forks source link

docker with path for reverse proxy https://example.com/somepath/ #3167

Closed chrismaster closed 3 days ago

chrismaster commented 1 week ago

Is it possible for docker to set a path with docker for a reverse proxy? Didn't find any environment variables, or env.file to set https://example.com/PATH/

chrismaster commented 1 week ago

What works is mount index.html Volume=%h/tmailDATA/index.html:/usr/share/nginx/html/index.html:Z (for podman with quadlet) and edit <base href="/"> to eg <base href="/tmail/"> Maybe not an elegant solution, but it works. Some environment variables would be a great addition. e.g. path, port, ... for changing port i had to mount nginx.conf
Volume=%h/tmailDATA/nginx.conf:/etc/nginx/nginx.conf:Z and change listen 80; to eg listen 3000; Thx for this cool project....

chibenwa commented 6 days ago

@hoangdat is this possible tohave a build parameter for this?

tk-nguyen commented 6 days ago

What works is mount index.html Volume=%h/tmailDATA/index.html:/usr/share/nginx/html/index.html:Z (for podman with quadlet) and edit <base href="/"> to eg <base href="/tmail/"> Maybe not an elegant solution, but it works. Some environment variables would be a great addition. e.g. path, port, ... for changing port i had to mount nginx.conf Volume=%h/tmailDATA/nginx.conf:/etc/nginx/nginx.conf:Z and change listen 80; to eg listen 3000; Thx for this cool project....

The base href is set at build time by flutter build web --base-href=<href>, see the comments in index.html here: https://github.com/linagora/tmail-flutter/blob/9aa438bc007930fd0f46d55c56be9c39c298f302/web/index.html#L14-L17

We can add an ARG to customize this.

We're using nginx.conf at https://github.com/linagora/tmail-flutter/blob/master/server/nginx.conf. This can also be customized by mounting it as template with environment variables, which will be rendered at runtime by the official nginx docker image: https://github.com/docker-library/docs/tree/master/nginx#using-environment-variables-in-nginx-configuration-new-in-119

chibenwa commented 6 days ago

The base href is set at build time by flutter build web --base-href=, see the comments in index.html here:

Ok this looks fair to me: at least it has an option. (thanks @tk-nguyen !)

@chrismaster this will be a cleaner way to achieve your goals. Maybe we could beter document this? PR to the doc on this topic welcome!

As such can we close this ticket?

kraftreich commented 6 days ago

Allright, just close. Going to test the nginx template envsubst configuration and create a PR.

If I get it correctly, for --base-href atm only possible to change during build, but not running/starting container image.

Thx C

tk-nguyen commented 6 days ago

Allright, just close. Going to test the nginx template envsubst configuration and create a PR.

If I get it correctly, for --base-href atm only possible to change during build, but not running/starting container image.

Thx C

Yes, flutter is handling the href configuration and building out a PWA. Note that these are just HTML, JS and CSS files, so you can use any web server.