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

override default cache headers for error pages #3206

Closed
bridiver opened this issue Jun 14, 2016 · 7 comments
Closed

override default cache headers for error pages #3206

bridiver opened this issue Jun 14, 2016 · 7 comments
Assignees
Labels
Milestone

Comments

@bridiver
Copy link

@bridiver bridiver commented Jun 14, 2016

We would like to change the default cache-control header from no-cache to private to prevent our CDN from caching 404s, etc..

@devinivy devinivy self-assigned this Jun 14, 2016
@devinivy
Copy link
Member

@devinivy devinivy commented Jun 14, 2016

You can set default route options (including client-caching options) on the server- and connection- level. See connections.routes here: http://hapijs.com/api#new-serveroptions. For further discussion or questions please feel free to open an issue at hapijs/discuss, which is better suited to general-purpose questions about hapi and its usage.

@devinivy devinivy closed this Jun 14, 2016
@bridiver
Copy link
Author

@bridiver bridiver commented Jun 14, 2016

this is only for error pages and @hueniverse told me to submit an issue for it

From Eran
Did you try to check forrequest.response.isBoomand if that’s the case, to set the cache header inrequest.response.output.header? If you open an issue on hapi asking for an override cache value when no caching is desired I can add it in the next couple of days.

@bridiver
Copy link
Author

@bridiver bridiver commented Jun 14, 2016

actually it's not just for error pages, we'd like to override it for any page that would normally be no-cache

@hueniverse hueniverse reopened this Jun 14, 2016
@hueniverse hueniverse assigned hueniverse and unassigned devinivy Jun 14, 2016
@hueniverse
Copy link
Contributor

@hueniverse hueniverse commented Jun 14, 2016

@devinivy they are asking for a different default value when caching is currently 'no-cache'. The 404 is just an example.

@devinivy
Copy link
Member

@devinivy devinivy commented Jun 14, 2016

Ah, I understand now– sorry about that!

@bridiver
Copy link
Author

@bridiver bridiver commented Jun 14, 2016

np, probably a bad explanation on my part

@hueniverse hueniverse added this to the 13.4.3 milestone Jul 5, 2016
@hueniverse hueniverse closed this in 9d8d617 Jul 5, 2016
@hueniverse hueniverse added feature and removed request labels Jul 5, 2016
@kanongil
Copy link
Contributor

@kanongil kanongil commented Jul 14, 2016

Documentation for the new cache.otherwise option is missing.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants