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

Add cache busting option to dev server #3897

Closed
kuon opened this Issue Sep 22, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@kuon

kuon commented Sep 22, 2017

When doing theme development, many files are are cached by the browser and I have to "hard reload" to get latests resources.

I propose to add an option to hugo server --noHttpCache that would add the following header to every requests:

Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Pragma: no-cache

To be used only in development of course.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Sep 22, 2017

Member

Chrome has an option in their dev console to turn off cache.

Member

bep commented Sep 22, 2017

Chrome has an option in their dev console to turn off cache.

@kuon

This comment has been minimized.

Show comment
Hide comment
@kuon

kuon Sep 22, 2017

Yes I know, but it aggressively turn it on again, and I also test with mobile browsers. The only way I found to clear the cache on some mobile browsers is to change the port. If this feature is not added I'll have to reverse proxy the hugo server to add the headers, but I think this should be built in.

kuon commented Sep 22, 2017

Yes I know, but it aggressively turn it on again, and I also test with mobile browsers. The only way I found to clear the cache on some mobile browsers is to change the port. If this feature is not added I'll have to reverse proxy the hugo server to add the headers, but I think this should be built in.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Sep 22, 2017

Member

@kuon I agree that this is a good idea, I just wanted to give you a temporary workaround if you didn't already know.

Member

bep commented Sep 22, 2017

@kuon I agree that this is a good idea, I just wanted to give you a temporary workaround if you didn't already know.

@bep bep added the Enhancement label Sep 22, 2017

@bep bep added this to the v0.29 milestone Sep 22, 2017

@bep bep self-assigned this Sep 22, 2017

@bep bep modified the milestones: v0.29, v0.28 Sep 22, 2017

@bep bep closed this in 0b34af2 Sep 22, 2017

@kuon

This comment has been minimized.

Show comment
Hide comment
@kuon

kuon Sep 22, 2017

kuon commented Sep 22, 2017

bep added a commit that referenced this issue Sep 23, 2017

Make noHTTPCache default on
This is a development server, so that makes the most sense.

See #3897
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment