"Fail open" question

If "Fail Open" mode is active (Pricing | Cloudflare Pages docs)
Once the daily request limit has been reached, Projects in fail open mode will bypass the Function and prevent it from operating on incoming traffic. Incoming requests will behave as if there was no Function, and pass through to the site’s static assets. This is the default configuration for all Pages projects.
I understand from the documentation that my _worker.js file would not be seen as a static asset, but what about if my _worker.js file imports some others files? For example, given the following _routes.json:
{
"version": 1,
"include": [
"/*"
],
"exclude": [
"/assets/*",
"/"
]
}
{
"version": 1,
"include": [
"/*"
],
"exclude": [
"/assets/*",
"/"
]
}
And the following directory structure:
├── _routes.json
├── _worker.js
├── assets
│ ├── chunks
│ │ └── some-public-file.js
│ └── static
│ └── some-public-file.css
├── index.html
└── server
├── imported-by-_worker.js
└── some-other-private-file.js
├── _routes.json
├── _worker.js
├── assets
│ ├── chunks
│ │ └── some-public-file.js
│ └── static
│ └── some-public-file.css
├── index.html
└── server
├── imported-by-_worker.js
└── some-other-private-file.js
In this case, in “Fail open” mode, can the content of server folder be visible, or does it still respect _routes.json? Will pages publicly serve my server-side source code(server directory) when an out-of-quota request is made to, for example /server/imported-by-_worker.js?
2 Replies
Walshy
Walshy4mo ago
Only the things in your asset output directory are served Anything server-side is not
Dani
DaniOP4mo ago
I'm not sure this answers my question. assets output and server code are in the same directory in the example (pages_build_output_dir). So the directory tree in my question is the pages_build_output_dir itself. @Walshy | Deploying
Want results from more Discord servers?
Add your server