Closed fabienmoyon closed 2 years ago
Seems it is already enabled in some projects. This issue is also about it: https://github.com/linagora/esn/issues/16 Need to investigate
Images shoud be served after {PREFIX}/images
(said by Andy)
FRONTEND_URL: inbox.open-paas.org.local
PREFIX: inbox/
Base href has no effect on absolute urls ({FRONTEND_URL}/{PREFIX}myresource
) root-relative urls (example /{PREFIX}myresource
)
It default value is the current path
Leading slash not needed (same behaviour with and without), but if 2 leading slashes, it uses it as url and not prefix (same scheme).
Trailing slash needed, if omitted the last base href path part is ignored, and if 2 trailing slahes, 2 appears in the links.
Should use a trailing slash and no leading slash, example is inbox/
We also could use no trailing and leading slashes, and just add on trailing slash on base href.
It would also make it easier to redirect {PREFIX}
to {PREFIX}/
{FRONTEND_URL}
should redirect to {FRONTEND_URL}/{PREFIX}
Omitting the trailing slash of prefix should redirect to {FRONTEND_URL}/{PREFIX}
For redirections, we could use nginx templates.
index.html
should be served on {FRONTEND_URL}/{PREFIX}
On every url ({FRONTEND_URL}/{PREFIX}#...
) the base href is the prefix, because the rest of the url is considered as an anchor.
index.html
should be served on {FRONTEND_URL}/{PREFIX}*
Base href should be set as soon as possible, after loading the /env/openpaas.js
Or the base href value could be set directly on index.html
when starting the docker image (modifying the file)
Or nginx could take care of replacing base href value when serving the index.html
(with sub_filter for example http://nginx.org/en/docs/http/ngx_http_sub_module.html)
2 solutions
env/openpaas.js
should be served on {FRONTEND_URL}/env/openpaas.js
We load it from /env/openpaas.js
, same path whatever is the current path.
env/openpaas.js
should be served on {FRONTEND_URL}/{PREFIX}env/openpaas.js
If we load it from env/openpaas.js
, with Html5mode, it would work if we land on {FRONTEND_URL}/{PREFIX}
(we could serve it on {FRONTEND_URL}/{PREFIX}/env/openpaas.js
) but would not work if we land on {FRONTEND_URL}/{PREFIX}path/to/page
for example.
Another solution would be to use root-relative url, cannot serve it on /{PREFIX}env/openpaas.js
because we do not know the prefix before this file is read (except if we replace/modify index.html
before serving it).
They should be served on {FRONTEND_URL}/{PREFIX}images/...
They should be loaded from images/...
or using root-relative urls from /{PREFIX}images/...
This would need to know the correct prefix.
cc @chamerling
Why do we need a prefix if each SPA is in its own subdomain?
instead of inbox.open-paas.org.local/inbox/ we just use inbox.open-paas.org.local and the application starts serving from there.
no we dont do that inbox.open-paas.org.local is just and example. we need to keep the prefix for the spa for different reason bucket / cdn / code ....
We can have the flexibility to use SPAs on the same domain or not
exactly, thats the usage of the base href
context
With oidc setup, oidc providers doesnt support hash (e.g keycloak).
to do
Wwe will have to replace fragment URI (angularjs router) ex: http://localhost:9900/inbox/#/auth/oidc/callback to http://localhost:9900/inbox/auth/oidc/callback
we will have to talk about it. If we directly switch to html5mode (old browser) replacing hash strategy or if we can mix strategy