-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)pkg: astroRelated to the core `astro` package (scope)Related to the core `astro` package (scope)pkg: nodeRelated to Node adapter (scope)Related to Node adapter (scope)
Description
Astro Info
Astro v5.17.2
Node v22.x
System Linux (Docker, behind Traefik reverse proxy)
Package Manager pnpm
Output server
Adapter @astrojs/node (v9.5.3)
If this issue only occurs in one browser, which browser is a problem?
Not browser-specific. Reproducible via curl.
Describe the Bug
When security.allowedDomains includes a protocol field, the X-Forwarded-Proto header is silently rejected, causing Astro.url to use http:// instead of https://.
This is a regression introduced in 5.17.2 via commit c13b536 ("Validate Host header against allowedDomains"), which was the fix for #14891.
Config:
export default defineConfig({
output: 'server',
adapter: node({ mode: 'standalone' }),
security: {
allowedDomains: [{ hostname: 'example.com', protocol: 'https' }],
},
})Headers sent by reverse proxy (i my case Traefik):
Host: example.com
X-Forwarded-Host: example.com
X-Forwarded-Proto: https
X-Forwarded-Port: 443
Result: Astro.url = http://example.com/... (protocol is http, not https)
Workaround: Remove protocol from the pattern:
allowedDomains: [{ hostname: 'example.com' }]What's the expected result?
When allowedDomains is [{ hostname: 'example.com', protocol: 'https' }] and the proxy sends X-Forwarded-Proto: https, Astro.url.protocol should be https:.
Link to Minimal Reproducible Example
unavailable, setup complicated
Participation
- I am willing to submit a pull request for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)pkg: astroRelated to the core `astro` package (scope)Related to the core `astro` package (scope)pkg: nodeRelated to Node adapter (scope)Related to Node adapter (scope)