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

Cache and URL Rewriting #1057

Closed
GuillaumeUnice opened this issue Jan 19, 2017 · 2 comments
Closed

Cache and URL Rewriting #1057

GuillaumeUnice opened this issue Jan 19, 2017 · 2 comments

Comments

@GuillaumeUnice
Copy link

Hi every,

I want to make a simple service worker cache so I have write the following function:


caches.open(CACHE) // Open a cache it's just key-value map system
		.then(function(cache){
			cache.addAll([ // add all files and directoy you want to cache
			'./index.html',
.
.
.

The issue is the URL rewriting when I go to www.mywebsite.com/index.html no problem
But if I go to the main URL www.mywebsite.com cache it's not able to link with the index.html page storage in cache.

What is the best solution to resolve that?
I have the same issue with some href wich use URL rewriting

Thanks for all

@wanderview
Copy link
Member

You can either:

  1. cache the index.html twice under both request URL
  2. Detect the other URL in your fetch handler and do a cache.match() against index.html

@GuillaumeUnice
Copy link
Author

GuillaumeUnice commented Jan 19, 2017

Thanks all works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants