Skip to content
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

better handle paths without extensions #4989

Closed
ashleymichal opened this issue Jan 3, 2020 · 2 comments
Closed

better handle paths without extensions #4989

ashleymichal opened this issue Jan 3, 2020 · 2 comments
Labels
bug Something that isn't working kv-asset-handler Relating to @cloudflare/kv-asset-handler

Comments

@ashleymichal
Copy link
Contributor

Reported in cloudflare/wrangler-legacy#980

if a path does not have a recognized extension, we currently assume that it is pointing to an html file, so hostname.ext/foo is automatically converted to hostname.ext/foo/index.html. This is rather specific to the expectations of a few select static site generators (esp hugo), however, it messes with files that have no extension (in the above issue, files under **/.well-known/*), and with other static site generators such as jekyll, who assume that hostname.ext/foo should be evaluated as hostname.ext/foo.html.

we need to update the default fetch from kv logic to:

  • try the original path first before trying other variations
  • try using Accept headers to evaluate mimetypes that cannot be evaluated based on extension

Depending on implementation these could be breaking changes; however if implemented properly they should be backwards compatible.

@ashleymichal ashleymichal added the bug Something that isn't working label Jan 3, 2020
@exvuma exvuma self-assigned this Jan 10, 2020
@tillkruss
Copy link

tillkruss commented Mar 8, 2022

I added a custom options.mapRequestToAsset handler to solve this for now.

  mapRequestToAsset: request => {
    if (request.url.includes('.well-known/')) {
      return new Request(url, request)
    }

    return mapRequestToAsset(new Request(request.url, request))
  },

@exvuma exvuma removed their assignment Mar 15, 2022
@GregBrimble GregBrimble transferred this issue from cloudflare/kv-asset-handler Feb 9, 2024
@GregBrimble GregBrimble added the kv-asset-handler Relating to @cloudflare/kv-asset-handler label Feb 9, 2024
@penalosa
Copy link
Contributor

I’m going to close this issue for now. Going forward, we’ll revisit the assets system as part of Pages/Workers convergence, and will inherit the benefits of the Pages assets system.

In the meantime, Pages is the best choice for deploying sites with static assets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working kv-asset-handler Relating to @cloudflare/kv-asset-handler
Projects
Archived in project
Development

No branches or pull requests

5 participants