Skip to content
Putting technology to work.
Insights to guide decisions and action.

Search articles

Astro 7.4.11 changes how forwarded headers are evaluated: what to check for SSR

Table of contents · 6 items

When you run an Astro site with SSR (rendering the page on every request) behind a CDN or load balancer, Astro internally receives the request from the intermediary rather than the URL the visitor sees. The original host name and the fact that the connection is https are reconstructed from headers such as X-Forwarded-Host and X-Forwarded-Proto that the intermediary adds. If this reconstruction goes wrong, the canonical URL, redirect targets and OGP URLs built from Astro.url end up with internal values such as http://localhost:4321.

Astro 7.4.11 (published to npm on November 11, 2026; dates are in UTC throughout) changed how Astro decides whether to trust these headers. It is a security-hardening fix, but depending on how your intermediary is configured, the host name that was used before may no longer be used after the update. In this article, we lay out what to check before updating, based on the original text of the changes and the results of passing the same inputs to 7.4.10 and 7.4.12.

What changed in 7.4.11

Astro trusts forwarded headers only when you list the allowed host names in security.allowedDomains of astro.config.mjs. If it is not configured, X-Forwarded-Host is ignored. The type definition’s description says “If the header doesn’t match any allowed pattern, the header is ignored and the request’s original host is used instead.” In place of a header that is not allowed, the host of the request the server received is used.

The 7.4.11 CHANGELOG lists the following changes to this validation.

  • Protocol, host and port are matched “together against each security.allowedDomains entry, instead of one at a time”
  • A forwarded protocol is applied only if the entry allows it for the host being used
  • A forwarded port is applied only if it is listed in that host’s entry
  • A forwarded host without X-Forwarded-Proto is “validated with the protocol of the server”
  • Entries with port: '443' (or '80' for http) now match hosts that do not include a port
  • Host and X-Forwarded-Host only accept the form “host name with an optional port”

In addition, a problem was fixed where, in a list mixing entries with and without a protocol, non-http(s) X-Forwarded-Proto values such as ftp and ws were accepted. 7.4.12 (November 13) did not change this validation; it mainly includes improvements such as reduced memory usage.

As of November 20, 2026, the latest version is 7.4.13 (November 18). 7.4.13 fixed a problem where the dev server blocked cross-origin requests from origins allowed by entries that specify a default port such as port: '443' (#18711). The CHANGELOG says “BaseApp.validateForwardedHost() now applies the same allowedDomains rules as the rest of Astro.” The file containing the validation function compared below (validate-headers) did not change between 7.4.12 and 7.4.13.

Results of passing the same inputs to 7.4.10 and 7.4.12

On November 15, 2026, we fetched astro 7.4.10 and 7.4.12 from npm, passed the same headers and allowlist to the validation function (validateForwardedHeaders) and compared the return values. The server-side values assume that the server internally receives http://localhost:4321. Values not included in the return value are not used, and the server-side values apply instead.

Input (allowlist and received headers)7.4.107.4.12
example.com restricted to https. Only Host arrives, with no ProtoHost acceptedHost also rejected
Same as above, and X-Forwarded-Proto: https also arriveshttps and host acceptedhttps and host accepted
The example.com entry has no port. 8443, listed only in another host’s entry, is forwardedPort 8443 also acceptedPort rejected
Entry with port: '443'. A host without a port arrivesHost rejectedHost accepted
**.example.com. evil.test@www.example.com arrivesAccepted as isRejected
Mixed entries with and without a protocol. X-Forwarded-Proto: ftp arrivesftp acceptedftp rejected

Four inputs whose results differ between Astro 7.4.10 and 7.4.12. A host that arrives without Proto is not accepted in 7.4.12. Port 8443, listed only in another host’s entry, is not accepted in 7.4.12. An entry with port 443 matches a host without a port in 7.4.12. A host containing @ is not accepted in 7.4.12

The first row is the case where what your site displays may change after the update. If your intermediary adds only X-Forwarded-Host and not X-Forwarded-Proto, and your allowlist is restricted to protocol: 'https', the host that was accepted in 7.4.10 falls back to the internal value in 7.4.12. This is because 7.4.10 treated a missing Proto as https when matching.

Conversely, the entry with port: '443' in the fourth row did not match hosts without a port in 7.4.10. Because the type definition’s examples also use this form, sites configured as in the examples will have the host accepted for the first time in 7.4.11 and later. However, the dev server’s (astro dev) cross-origin check did not match entries written in this form up to 7.4.12 (the 7.4.13 fix mentioned above). When testing on a local dev server, use 7.4.13 or later.

Note that this comparison called the validation function directly. We have not verified real requests through adapters such as @astrojs/node, or behavior behind any specific CDN.

Which sites are affected and which are not

The headers are read by pages rendered on each request. Static sites that generate every page at build time (such as GH Media itself) do not use this validation, because Astro does not receive requests when the pages are served.

You should check the impact if your site meets all of the following conditions.

  • It uses output: 'server', or has pages set to prerender = false individually
  • It has security.allowedDomains configured
  • Pages or middleware build URLs from Astro.url (or context.url)

According to the type definition’s description, form origin checking (security.checkOrigin) also works by comparing a header sent by the browser with “the Request URL.” Because a change in how the request URL is built may affect the result of this check, sites with forms should also confirm with real submissions after updating (this connection is the editorial team’s interpretation; we have not verified submission behavior).

What to check before updating (editorial suggestion)

  1. Write down your allowlist. For each entry in security.allowedDomains of astro.config.mjs, note whether protocol and port are specified. Entries with only protocol: 'https', and configurations that list ports in separate entries, are the ones whose results changed in the comparison above.
  2. Check the headers your intermediary adds. In the settings of your CDN, load balancer or reverse proxy (such as nginx), check whether X-Forwarded-Proto is added. For nginx, look for a line like proxy_set_header X-Forwarded-Proto $scheme;. If it is not added, X-Forwarded-Host alone may not be accepted in 7.4.11 and later.
  3. Send the same headers in a test environment. Send a request such as curl -H 'X-Forwarded-Host: www.example.com' -H 'X-Forwarded-Proto: https' http://localhost:4321/ to the updated server (the latest version as of November 20, 2026 is 7.4.13), and check the canonical and redirect URLs. Also trying without Proto helps you catch gaps in your intermediary’s configuration. We did not run this command against a real server when writing this article.
  4. Choose a fix. The proper fix is to have your intermediary add X-Forwarded-Proto. You could also make the allowlist accept requests by removing protocol, but that means accepting forwarding over http as well, so the editorial team does not recommend it.

We also covered a past case where an Astro update changed local scripts and output in our article on environment variables in Astro 7.4.5. The issue where authentication protection was bypassed in the Node adapter is covered in our article on the base setting.

Scope of verification

On November 15, 2026, we reviewed the withastro/astro CHANGELOG (7.4.11 and 7.4.12), the commit with the change (08e2cee, #18641), the type definition documentation and the npm publication dates (desk research). We also passed six inputs to the validation function in astro 7.4.10 and 7.4.12 fetched from npm and compared the results (Node.js 22.23.4). We did not test real requests through an adapter, behavior behind a CDN or load balancer, or run the curl command above. On November 20, 2026, we confirmed the CHANGELOG and change (#18711) for 7.4.13 (November 18), and that the file containing the validation function did not change in the diff from 7.4.12.

GleamHub’s website development consulting covers building websites with Astro and checking updates after launch. What to check depends on your setup, so please reach out through our contact form.

References

Share this articleXFacebook
Kakeru Suzuki

Fascinated by the possibilities of technology, has had a deep interest in programming and digital art since student days

Turn this article's theme into your company's next step

Starting from what you want to achieve with your website.

We organize user goals, required features, and ongoing maintenance structures to determine the first steps in development and improvement.

  • Website objectives
  • Features and usability
  • Post-launch operations
Consult on web development and improvements

You can consult with us from the initial conceptual stage. Details from this article will be carried over to the inquiry form.

Receive the latest articles via email · Read the web production guide
Free download

Complete Guide to Web Production: Costs, Vendor Selection & Traffic Acquisition [2026 Edition]

We have compiled cost benchmarks, vendor selection criteria, and traffic acquisition strategies into a PDF.

The PDF and newsletter emails are currently in Japanese.

You will also be subscribed to our newsletter. You can unsubscribe at any time.