-
Notifications
You must be signed in to change notification settings - Fork 670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pages-shared] Remove extension name check when generating response #4051
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-4051 You 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-4051 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6337663359/npm-package-wrangler-4051 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6337663359/npm-package-cloudflare-pages-shared-4051 Note 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
The tests for this are currently internal, unfortunately. Will add tests for this there.
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.html
exists.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 review
so future reviewers can take inspiration and learn from it.