Repository navigation
fix(static): redirections nginx relatives (évite http:// derrière le proxy TLS) - #305
Merged
Merged
Conversation
…proxy TLS) Le pack statique sert les sites avec la config nginx:alpine par défaut. Derrière le proxy TLS, nginx reçoit du http : /apps/x (dossier sans barre finale) renvoyait 301 Location: http://jeser.app/apps/x/, puis erreur 500 sur le port 80. absolute_redirect off produit Location: /apps/x/, qui reste en https côté navigateur.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problème
Sur https://jeser.app (projet jeser, pack static), une URL de fiche sans barre finale, par exemple
/apps/popcornn, renvoie :301 Location: http://jeser.app/apps/popcornn/, en http,500(Server: Pingora) sur le port 80.Les 7 fiches sont touchées. Avec la barre finale, la page répond 200.
Cause
L'image du pack statique (
static_inline_dockerfile) utilise la confignginx:alpinepar défaut. Pour un dossier demandé sans barre finale, nginx ajoute la barre par une redirection absolue construite avec le schéma de la requête reçue. Or, derrière le proxy TLS, nginx reçoit du http. L'en-têteX-Forwarded-Proton'est pas pris en compte par cette redirection.Correctif
L'image ajoute
/etc/nginx/conf.d/00-devforge-redirect.conf, qui contientabsolute_redirect off;. Ce fichier est inclus au niveauhttpet hérité par leserverpar défaut. Nginx renvoie alorsLocation: /apps/x/, une redirection relative : le navigateur reste en https quel que soit le proxy.Le correctif vaut pour tous les projets du pack statique.
Tests
cargo test -p devforge-deploy --lib: 87/87 ; une assertion a été ajoutée surabsolute_redirect off;.default.confquenginx:alpine) servant ledistdu build de bobdivx/jeser, requêtes en http avecHost: jeser.appetX-Forwarded-Proto: https:/apps/<fiche>→301 http://jeser.app:18080/apps/<fiche>/;/apps/<fiche>→301 /apps/<fiche>/, et/apps/<fiche>/→ 200 pour les 7 fiches (devforge, devforge-esp, popcornn, sonozz, starbasefr, teslasphere, vigie).nginx -tOK.Mise en ligne (non faite)
Il faut une release DevForge, puis un redéploiement du projet jeser pour reconstruire son image.