Yes, that filter code is how you can customize the start_url
.
I can see that WP Rocket is indeed messing up the service worker response:
- It’s causing the response to have an
text/html
content type as opposed to the text/javascript
.
- It’s adding an HTML comment to the end of the JS response:
This website is like a Rocket, isn't it? Performance optimized by WP Rocket. Learn more: https://wp-rocket.me - Debug: cached@1613062286
.
Both of these indicate WP Rocket is failing to see what the original content type was in the response. It should only be caching HTML responses, not JS ones.
A quick fix would be for you to exclude the /wp.serviceworker
URL from WP Rocket. But WP Rocket should not be doing what it is at present.
It’s done. Thank you for your prompt response!
@westonruter I am facing this same issue and was delighted to find your response. I am using WP Rocket for a few weeks now. I know this topic is closed but I find out response helpful.
@julien-alibert, please can you let me know where you excluded the URL /wp.serviceworker? Would that be in the WP Rocket settings under “Advanced rules”?
Thank you for your feedback
@deetee1 I don’t use WP Rocket, but I did find this docs page: https://docs.wp-rocket.me/article/54-exclude-pages-from-the-cache
Look for the “Never Cache URL(s)” setting I think and add /wp.serviceworker
to the list.