[pages-shared] Remove extension name check when generating response#4051
[pages-shared] Remove extension name check when generating response#40511000hz merged 1 commit intocloudflare:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 41294df The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
I'm not sure how to add a corresponding test to pages-shared. However, I have tested this locally with |
|
hey @nevikashah :) can someone on your team please take a look at this? |
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6337663359/npm-package-wrangler-4051You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6337663359/npm-package-wrangler-4051Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6337663359/npm-package-wrangler-4051 dev path/to/script.jsAdditional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6337663359/npm-package-cloudflare-pages-shared-4051Note that these links will no longer work once the GitHub Actions artifact expires.
| Please ensure constraints are pinned, and |
Codecov Report
@@ Coverage Diff @@
## main #4051 +/- ##
==========================================
+ Coverage 75.02% 75.06% +0.03%
==========================================
Files 216 216
Lines 12026 12026
Branches 3115 3115
==========================================
+ Hits 9023 9027 +4
+ Misses 3003 2999 -4 |
|
I have a web site that uses IIS on a hosted platform and is fronted by Cloudflare. I just tested this on 2024-04-09. I have a user account for my website registered on my website for testing purposes, with the username "my.name". Right now, if I browse to mywebsite.com/my.name/ the route successfully displays the profile of the my.name user. If I browse to mywebsite.com/my.name without the ending-slash, an HTTP ERROR 404 occurs. |
|
I should add that I have other 'registered users' on the site with usernames that don't have a period in the username and they work fine with or without an ending-slash. I'm not so sure this is a 'Cloudflare-specific issue' with regards to my website, I'm thinking it's an issue with IIS, and those who have direct access to the IIS server can configure something to solve this. However I'm using shared hosting and I don't have the ability to specifically configure IIS. So, I want Microsoft to give me a solution through web.config (they don't appear to) or I was hoping perhaps Cloudflare could provide an answer to this -- like maybe let me set a configuration to automatically append a slash to the end of a URL that has a period in it, before forwarding the request on to my shared hosting that uses IIS. |
This works with |
Fixes #2779.
What this PR solves / how to test:
Using regex for filename to check whether it is a directory or not is broken, and current regex logic
/\/.+\.[a-z0-9]+$/i.test(path)causes troubles for dir filenames like:By removing the extension check, workers could always check whether
${pathname}/index.htmlexists.Associated docs issue(s)/PR(s):
Author has included the following, where applicable:
Reviewer is to perform the following, as applicable:
Note for PR author:
We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label
highlight pr reviewso future reviewers can take inspiration and learn from it.