Skip to content
This repository was archived by the owner on Feb 9, 2024. It is now read-only.

Conversation

@boemekeld
Copy link
Contributor

Hey guys,

In some cases, "index.html" is not the default document.
I work on some projects that are being migrated to Edge and that use "index.shtm" for example.
For this, I suggest the inclusion of an option defaultDocument.

Thanks. 👍

@@ -1,2 +1 @@
node_modules
dist No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove dist from .gitignore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @SukkaW, my mistake. Was solved. Thanks.

@SukkaW
Copy link
Contributor

SukkaW commented Dec 15, 2020

I work on some projects that are being migrated to Edge and that use "index.shtm" for example.

shtml is not "static HTML". It is "server-side HTML" which means the served file is generated dynamically.

Thus if you are migrating a website from shtml to html, DO NOT KEEP .shtm. Rename those files into .html instead.

@boemekeld
Copy link
Contributor Author

website

I am building a platform that can host different stacks, including websites with SSI (Server Side Includes).

There are a number of reasons that do not allow me to rename the files to .HTML, like as SEO, compatibility with other environments, etc.

In this necenary, SHTML files are previously generated in the build stage, so they are static files.

I appreciate your comment. Thanks.

@boemekeld
Copy link
Contributor Author

Hi @SukkaW

Could you review this pull request?

Thanks.

@boemekeld
Copy link
Contributor Author

Up

@kristianfreeman
Copy link
Contributor

@boemekeld would you mind rebasing?

@boemekeld
Copy link
Contributor Author

@signalnerve of course! I will do this soon.

@boemekeld
Copy link
Contributor Author

@signalnerve done!

@Cherry
Copy link
Contributor

Cherry commented May 21, 2021

Thanks, this looks like a good change and should close #87.

@boemekeld Could you add a test for this new functionality for mapRequestToAsset in src/test/mapRequestToAsset.ts?

@boemekeld
Copy link
Contributor Author

@Cherry yes, let me check it.

@boemekeld
Copy link
Contributor Author

@Cherry done!

@kristianfreeman
Copy link
Contributor

@Cherry done!

we're going to work on supporting running our test workflow on pull requests, but in the meantime, can you post your test output here just so I have a paper trail before merge? ty!

@boemekeld
Copy link
Contributor Author

@signalnerve sure.

@cloudflare/[email protected] pretest C:\git\bohr-cloud\kv-asset-handler
npm run build

@cloudflare/[email protected] build C:\git\bohr-cloud\kv-asset-handler
tsc -d

@cloudflare/[email protected] test C:\git\bohr-cloud\kv-asset-handler
ava dist/test/*.js --verbose

  • getAssetFromKV » getAssetFromKV when body not empty, should invoke .cancel()
    √ mapRequestToAsset » mapRequestToAsset() correctly changes /about -> /about/index.html
    √ mapRequestToAsset » mapRequestToAsset() correctly changes /about/ -> /about/index.html
    √ mapRequestToAsset » mapRequestToAsset() correctly changes /about.me/ -> /about.me/index.html
    √ mapRequestToAsset » mapRequestToAsset() correctly changes /about -> /about/default.html
    √ serveSinglePageApp » serveSinglePageApp returns root asset path when request path ends in .html
    √ serveSinglePageApp » serveSinglePageApp returns root asset path when request path does not have extension
    √ serveSinglePageApp » serveSinglePageApp returns requested asset when request path has non-html extension
    Environment doesnt support readable streams
    √ getAssetFromKV » getAssetFromKV does not cache on Cloudflare when bypass cache set
    Environment doesnt support readable streams
    √ getAssetFromKV » getAssetFromKV if not in asset manifest still returns nohash.txt
    √ getAssetFromKV » getAssetFromKV when setting browser caching
    √ getAssetFromKV » getAssetFromKV when namespace not bound fails
    √ getAssetFromKV » getAssetFromKV return correct val from KV and default caching
    √ getAssetFromKV » getAssetFromKV evaluated the file matching the extensionless path first /client/ -> client
    √ getAssetFromKV » getAssetFromKV evaluated the file matching the extensionless path first /client -> client
    √ getAssetFromKV » getAssetFromKV if no asset manifest /client -> client fails
    √ getAssetFromKV » getAssetFromKV if sub/ -> sub/index.html served
    √ getAssetFromKV » getAssetFromKV gets index.html by default for / requests
    √ getAssetFromKV » getAssetFromKV non ASCII path support
    √ getAssetFromKV » getAssetFromKV supports browser percent encoded URLs
    √ getAssetFromKV » getAssetFromKV supports user percent encoded URLs
    √ getAssetFromKV » getAssetFromKV custom key modifier
    √ getAssetFromKV » getAssetFromKV with no trailing slash on root
    √ getAssetFromKV » getAssetFromKV with no trailing slash on a subdirectory
    √ getAssetFromKV » getAssetFromKV no result throws an error
    √ getAssetFromKV » getAssetFromKV passing in a custom NAMESPACE serves correct asset
    √ getAssetFromKV » getAssetFromKV when setting custom cache setting
    √ getAssetFromKV » getAssetFromKV when custom namespace without the asset should fail
    √ getAssetFromKV » getAssetFromKV only decode URL when necessary
    √ getAssetFromKV » getAssetFromKV Support for user decode url path
    √ getAssetFromKV » getAssetFromKV when etag and if-none-match are present but if-none-match !== etag, should bypass cache
    √ getAssetFromKV » getAssetFromKV caches on two sequential requests
    √ getAssetFromKV » getAssetFromKV if-none-match not sent but resource in cache, should return hit
    √ getAssetFromKV » getAssetFromKV if range request submitted and resource in cache, request fulfilled
    √ getAssetFromKV » getAssetFromKV TTls set to null should not cache on browser or edge (111ms)
    Environment doesnt support readable streams
    Environment doesnt support readable streams
    √ getAssetFromKV » getAssetFromKV does not store max-age on two sequential requests (116ms)
    √ getAssetFromKV » getAssetFromKV when if-none-match === etag and etag === pathKey in manifest, should revalidate (108ms)

36 tests passed
1 test todo

Copy link
Contributor

@Cherry Cherry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution!

@kristianfreeman kristianfreeman merged commit 7eb29f4 into cloudflare:master May 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants