fix: détection HTTPS et crash i18n étape 3 installation

- install.go : detectPublicURL utilise https pour tout domaine public
  même si Traefik envoie X-Forwarded-Proto: http en interne
- fr.json / en.json : échappe le @ dans proxmoxTokenHint avec {'@'}
  (vue-i18n interprétait @realm comme un linked message → SyntaxError)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
enzo 2026-03-20 23:03:17 +01:00
parent a1090db802
commit 15965082ce
3 changed files with 23 additions and 4 deletions

View file

@ -210,15 +210,34 @@ func (h *InstallHandler) Configure(w http.ResponseWriter, r *http.Request) {
} }
// detectPublicURL inférer l'URL publique depuis les headers de la requête entrante. // detectPublicURL inférer l'URL publique depuis les headers de la requête entrante.
// Traefik termine TLS en amont et communique en HTTP avec le backend.
// On fait confiance à X-Forwarded-Proto quand il vaut "https", et on suppose
// HTTPS pour tout domaine réel (avec un point) même si X-Forwarded-Proto est absent ou "http".
func detectPublicURL(r *http.Request) string { func detectPublicURL(r *http.Request) string {
host := r.Header.Get("X-Forwarded-Host") host := r.Header.Get("X-Forwarded-Host")
if host == "" { if host == "" {
host = r.Host host = r.Host
} }
proto := "https"
if r.Header.Get("X-Forwarded-Proto") == "http" || (!strings.Contains(host, ".") && !strings.Contains(host, ":")) { fwdProto := r.Header.Get("X-Forwarded-Proto")
var proto string
switch {
case fwdProto == "https":
proto = "https"
case r.TLS != nil:
proto = "https"
case strings.Contains(host, ".") &&
!strings.HasPrefix(host, "localhost") &&
!strings.HasPrefix(host, "127.") &&
!strings.HasPrefix(host, "10.") &&
!strings.HasPrefix(host, "192.168."):
// Domaine public → toujours HTTPS
proto = "https"
default:
proto = "http" proto = "http"
} }
return fmt.Sprintf("%s://%s", proto, host) return fmt.Sprintf("%s://%s", proto, host)
} }

View file

@ -34,7 +34,7 @@
"sshFailed": "SSH connection failed", "sshFailed": "SSH connection failed",
"proxmoxUrl": "Proxmox URL", "proxmoxUrl": "Proxmox URL",
"proxmoxToken": "Proxmox API token", "proxmoxToken": "Proxmox API token",
"proxmoxTokenHint": "Format: PVEAPIToken=user@realm!tokenid=secret", "proxmoxTokenHint": "Format: PVEAPIToken=user{'@'}realm!tokenid=secret",
"back": "Back", "back": "Back",
"next": "Next", "next": "Next",
"finish": "Complete installation", "finish": "Complete installation",

View file

@ -34,7 +34,7 @@
"sshFailed": "Connexion SSH échouée", "sshFailed": "Connexion SSH échouée",
"proxmoxUrl": "URL Proxmox", "proxmoxUrl": "URL Proxmox",
"proxmoxToken": "Token API Proxmox", "proxmoxToken": "Token API Proxmox",
"proxmoxTokenHint": "Format : PVEAPIToken=user@realm!tokenid=secret", "proxmoxTokenHint": "Format : PVEAPIToken=user{'@'}realm!tokenid=secret",
"back": "Retour", "back": "Retour",
"next": "Suivant", "next": "Suivant",
"finish": "Terminer l'installation", "finish": "Terminer l'installation",