georchestra / docker

Quick start geOrchestra with docker
18 stars 22 forks source link

Fix infinite redirection when path root contains query params #203

Closed marwanehcine closed 1 year ago

marwanehcine commented 1 year ago

to fix infinite redirection when path root contains query params, traefik redirection rules in docker-compose.override.yml has to be updated. A new regex formula is used to check is query param exist or not

jahow commented 1 year ago

I have tested this and it works, but I think the regex is misleading. Something like that would be clearer IMO:

- "traefik.http.middlewares.add-trailing-slash.redirectregex.regex=^https?://(.+)/([^?]+)(\\?.*)?$"
- "traefik.http.middlewares.add-trailing-slash.redirectregex.replacement=https://$${1}/$${2}/$${3}"

Here we add a third capturing group containing query params, which we reappend after the trailing slash. What do you think @marwanehcine?

jeanmi151 commented 1 year ago

I have tested this and it works, but I think the regex is misleading. Something like that would be clearer IMO:

- "traefik.http.middlewares.add-trailing-slash.redirectregex.regex=^https?://(.+)/([^?]+)(\\?.*)?$"
- "traefik.http.middlewares.add-trailing-slash.redirectregex.replacement=https://$${1}/$${2}/$${3}"

Here we add a third capturing group containing query params, which we reappend after the trailing slash. What do you think @marwanehcine?

can you please continue this PR here : https://github.com/georchestra/docker/pull/197 to not have duplicates