-
Notifications
You must be signed in to change notification settings - Fork 47
Allow extensionless file paths to be served #73
Conversation
gabbifish
left a comment
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.
Awesome work so far! Something that we really need to make sure of is that we're not breaking our backwards-compatible contract with the "Clean URL" spec--specifically, paths like /client/ should always map to /client/index.html. (https://en.wikipedia.org/wiki/Clean_URL)
^ this behavior above is what we have at the moment.
| t.fail('Response was undefined') | ||
| } | ||
| }) | ||
| test('getAssetFromKV evaluated the file matching the extensionless path first /client/ -> client', async t => { |
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.
shouldn't this map to client/index.html, consistent with https://en.wikipedia.org/wiki/Clean_URL?
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.
The purpose of this PR is to not exclusively match html files and have raw files be an option (e.g. upload and serve a .env )
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.
to back this one up: not all major static site generators adhere to that standard
bb2c04d to
1269af0
Compare
Sorry it took me awhile to get back to this (it got lost in my email during vacay my B)! I think there is some confusion on the problem this PR is solving. Before this PRBefore This PRIf |
| t.fail('Response was undefined') | ||
| } | ||
| }) | ||
| test('getAssetFromKV evaluated the file matching the extensionless path first /client/ -> client', async t => { |
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.
to back this one up: not all major static site generators adhere to that standard
Co-Authored-By: Ashley Michal <[email protected]>
Checks asset manifest for the extensionless file matching the request first and then uses
mapRequestToAssetto map the HTML equivalent if it doesn't exist.fixes part of cloudflare/wrangler-legacy#980
Disclaimer:
filename) to validate it's there not an extensionless file present on every request before checking the namespace for the .html equivalent. That would add latency and be complicated so I vote not to do that. This is a rare edge case and maybe we should just start requiring asset manifest? Or just document this and see if anyone even runs into that.