Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Add no-cache headers by default #522

Merged
merged 3 commits into from
Oct 30, 2015
Merged

Conversation

leplatrem
Copy link
Contributor

# Since Expires has resolution in seconds, do not use cache_expires
# in order to omit it.
response.cache_control.no_cache = True
response.pragma = 'no-cache'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think pragma is a response header, even in HTTP/1.0 it was only a request header, right? See http://stackoverflow.com/a/15050018/680454

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, oh. To be honest, I just had a look at the underlying http library of the Pyramid framework, and copied this :) https://github.com/Pylons/webob/blob/master/webob/response.py#L953

I will remove it, and update the tests, thanks!

@leplatrem leplatrem force-pushed the add-pragma-no-cache-by-default branch from bead02d to 4c43a85 Compare October 29, 2015 10:35
@leplatrem
Copy link
Contributor Author

@michielbdejong I updated the PR with your suggestion (getting rid of Pragma response header, and rebasing on the cache restricted to anonymous requests)

@Natim any feedback ?

resp = self.app.get('/moistures')
self.assertIn('no-cache', resp.headers['Cache-Control'])
self.assertNotIn('Expires', resp.headers)
self.assertNotIn('Pragma', resp.headers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this, since it is not a feature to not have them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok got it sorry for the noise

@Natim
Copy link
Contributor

Natim commented Oct 29, 2015

It looks good to me apart from the Pragma thing.

@leplatrem
Copy link
Contributor Author

apart from the Pragma thing.

Do you think we should put some Pragma response header ?

@leplatrem leplatrem force-pushed the add-pragma-no-cache-by-default branch from 4d97c7f to 0b6a88b Compare October 30, 2015 12:20
@leplatrem leplatrem force-pushed the add-pragma-no-cache-by-default branch from 0b6a88b to 9f8fffd Compare October 30, 2015 15:01
Natim added a commit that referenced this pull request Oct 30, 2015
@Natim Natim merged commit e2b3edf into master Oct 30, 2015
@Natim Natim removed the in progress label Oct 30, 2015
@Natim Natim deleted the add-pragma-no-cache-by-default branch October 30, 2015 15:45
glasserc pushed a commit that referenced this pull request May 20, 2016
Fix the Dockerfile: install pip from apt
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants