ember-cli-fastboot
ember-cli-fastboot copied to clipboard
Fastboot doesn't run with http://localhost:4200/?fastboot=true, but does on CURL
We have just begun to add fastboot to our project, and have run into this issue.
Starting the server with ember serve
does not seem to use fastboot by default when I visit localhost:4200?fastboot=true
from the browser. It does however run with this command in terminal curl 'http://localhost:4200/' -H 'Accept: text/html'
.
The ember-cli
terminal only prints App is being served by FastBoot
when I make the request via CURL, but not if I visit via the browser. Could this have anything to do with our use of a service worker?
Could this have anything to do with our use of a service worker?
Absolutely! I would recommend disabling SW while developing.
Thanks @simonihmig that was the culprit!
Just as an aside, will the use of service workers have any bearing in the production environment?
@simonihmig I would also like to know if there is any interaction between fastboot and ember-service-worker
in production?
Yes, depending on your SW's implementation, a user might hit your FastBoot server only for the first ever visit. After that any following visit would not load the HTML page from the server, but rather use the index.html cached by your SW. At least that's how ember-service-worker-index
would behave.
I see, that makes sense. Maybe it should be documented in ember-service-worker-index? Maybe a better setup for sw + fastboot would involve allowing ember-service-worker-cache-fallback
to serve index.html only when network is unavailable?