The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Cloudflare Pages treats static files and Pages Function responses differently. A _redirects rule does not redirect a request served by a Function, and a _headers rule does not add headers to a Function-generated response. Separately, the files in your deployed output—including a matching HTML file or 404.html—affect how static routes resolve. Those documented behaviors explain many apparent inconsistencies, but they are not measurements of a particular site.
Why can a Pages Function bypass _redirects and _headers?
Cloudflare applies _redirects and _headers to static asset responses. They do not automatically govern a response produced by Pages Functions. If a Function handles a matching request, a redirect written for static assets will not be applied to that Function response, and headers listed in _headers will not be added to it.
As an Amazon Associate I earn from qualifying purchases.
This distinction is about which component serves the response, not simply whether a path appears to match a rule. A Function can return its own response or, if written to do so, fall through to asset serving. If the Function generates the response, implement the needed redirect or headers in the Function. If the static rule should handle the request instead, configure routing so the request is excluded from Functions.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Separate the three response paths
| Request outcome | What to inspect | Documented implication |
|---|---|---|
| A matching static asset is served without a Function handling the path | Status, Location, and response headers |
Static _redirects and _headers rules can affect the asset response. |
| A Function generates the response | Whether the Function ran, status, Location, and response headers |
Static redirect and header rules do not apply to that generated response. |
| A Function deliberately falls through to asset serving | Whether the Function ran and whether the final response came from asset serving | Do not assume a rule applied merely because its path pattern matches; verify the response and the Function’s fallback behavior. |
Cloudflare documents that redirects run before headers when both static rule files match. A redirect therefore takes priority over a header rule for that request; it is not a way to attach headers to a response generated by a Function.
#1 Best Overall
How can you tell whether the static output is changing a route result?
Pages’ static route behavior depends on the deployed output. A request can match an HTML file, be redirected from an HTML filename to its extensionless URL, use the default single-page-app behavior, or resolve through a custom 404 page. Changing the output files can therefore change the result even when the requested URL stays the same.
- If a path matches an HTML file, Pages serves that file. Pages also redirects HTML filenames to extensionless counterparts, including
/contact.htmlto/contactand/about/index.htmlto/about/. - By default, Pages supports single-page applications by mapping incoming paths to the root so the client-side app can handle routes such as
/aboutor/help. - Deploying a
404.htmlchanges not-found handling. Pages looks for the closest 404 page, moving up the directory tree and ultimately to/404.html.
For a useful comparison, hold the requested path constant and vary the deployed output: first use a matching HTML file, then test without it, then test with a 404.html. Record the status and any Location header. Do not treat an SPA fallback as proof that every unknown path will return the same result when the output or Function routing differs.
Rank #2
How does _routes.json affect whether Function code runs?
Pages uses _routes.json include and exclude rules to control which paths invoke Functions. Exclusions take priority. A static route can be excluded so it does not invoke Function code, which is useful when static files and Function routes coexist. For a Function that needs to serve an asset, Cloudflare’s API reference describes the ASSETS binding as the asset-serving path.
Recommended Free Tools
Cloudflare’s documented constraints are at least one include rule, no more than 100 combined include and exclude rules, and a maximum of 100 characters per rule. These are platform limits, not measurements of an individual deployment.
Rank #3
- Used Book in Good Condition
Test route selection independently
- Choose one URL that has a known static asset or fallback result.
- Check whether the URL is included or excluded in the deployed
_routes.json; exclusions take priority. - Request it with the current routing configuration and record whether Function code ran, along with status,
Location, and relevant headers. - Change only the route inclusion or exclusion, deploy again, and repeat the request. This separates a change in Function invocation from a change in the static output.
What should you record when testing these behaviors?
The title of an investigation cannot establish which two behaviors were measured or what a particular project returned. To make a result reproducible, capture the conditions alongside each response rather than inferring behavior from a matching filename or rule.
| Condition to record | Response evidence |
|---|---|
Requested path and deployed output files, including matching HTML and any 404.html |
Status and Location |
Whether _redirects or _headers contains a matching rule |
Relevant response headers |
Whether the path is included or excluded by _routes.json, and whether Function code ran |
Function-generated response versus asset-serving fallback |
| Whether the request is a first request or a conditional repeat | Etag, request If-None-Match, and status |
| Deployment time and requesting location or data center, if available | Response status and cache-related headers |
How should you interpret repeat requests and cache results?
Pages sends Etag headers with 200 responses. A later request can include If-None-Match; when it matches, Pages can return 304 Not Modified so the browser can use its cached copy. That is cache validation, not a redirect.
Cloudflare describes a one-week asset-cache TTL per data center, while noting that assets may disappear earlier. Treat that as a retention description, not a promise that every data center will retain an asset for the full week or share identical cache history. For repeat-request comparisons, note the deployment time and requesting location when available, and record the validator headers as well as the status.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




