Skip to content

fix(static): redirections nginx relatives (évite http:// derrière le proxy TLS) - #305

Merged
bobdivx merged 1 commit into
mainfrom
fix/static-relative-redirect
Nov 3, 2026
Merged

bobdivx merged 1 commit into
mainfrom
fix/static-relative-redirect

Conversation

@bobdivx

@bobdivx bobdivx commented Nov 3, 2026

Copy link
Copy Markdown
Owner

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,
  • puis 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 config nginx:alpine par 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ête X-Forwarded-Proto n'est pas pris en compte par cette redirection.

Correctif

L'image ajoute /etc/nginx/conf.d/00-devforge-redirect.conf, qui contient absolute_redirect off;. Ce fichier est inclus au niveau http et hérité par le server par défaut. Nginx renvoie alors Location: /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 sur absolute_redirect off;.
  • nginx 1.30.6 (paquet officiel, même default.conf que nginx:alpine) servant le dist du build de bobdivx/jeser, requêtes en http avec Host: jeser.app et X-Forwarded-Proto: https :
    • avant : /apps/<fiche> → 301 http://jeser.app:18080/apps/<fiche>/ ;
    • après : /apps/<fiche> → 301 /apps/<fiche>/, et /apps/<fiche>/ → 200 pour les 7 fiches (devforge, devforge-esp, popcornn, sonozz, starbasefr, teslasphere, vigie). nginx -t OK.

Mise en ligne (non faite)

Il faut une release DevForge, puis un redéploiement du projet jeser pour reconstruire son image.

…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.
@bobdivx
bobdivx merged commit 6682ffc into main Nov 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant