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

Ensure Date header on expires_in #3479

Merged
merged 3 commits into from Feb 18, 2012

Conversation

Projects
None yet
3 participants
@arvida

arvida commented Oct 31, 2011

Background: Some webservers (thin and passenger for example) don't add a HTTP Date header to the response. This is not a problem for modern browsers but it can cause problems with other HTTP clients, for example Amazon's CloudFront expects a Date header when it gets a Cache-Control max-age value and .Net's HttpWebRequest's have some similar issue.
From what I understand the HTTP spec says that the client should use the Date header when calculating how a long a cached response is valid.

I can see that the Date header might not be Rails responsibility, but I think it would be good if #expires_in ensures that the client can use Cache-Control's max-age value by setting a Date header in the response. What you think about this?

@arvida

This comment has been minimized.

Show comment
Hide comment
@arvida

arvida Oct 31, 2011

Owner

Just copied of how the last_modified accessors have been implemented when defining the date accessors

Owner

arvida commented on 964b282 Oct 31, 2011

Just copied of how the last_modified accessors have been implemented when defining the date accessors

@josevalim

This comment has been minimized.

Show comment
Hide comment
@josevalim

josevalim Oct 31, 2011

Contributor

Leaving this open for discussion. As you said, setting the Date header is not Rails responsibility and I have never run into issues myself.

Contributor

josevalim commented Oct 31, 2011

Leaving this open for discussion. As you said, setting the Date header is not Rails responsibility and I have never run into issues myself.

@arvida

This comment has been minimized.

Show comment
Hide comment
@arvida

arvida Nov 1, 2011

For me it comes down to that I want to be sure I get the expected behavior when calling expires_in.

arvida commented Nov 1, 2011

For me it comes down to that I want to be sure I get the expected behavior when calling expires_in.

azimux pushed a commit to azimux/rails that referenced this pull request Dec 11, 2011

Fix JSON decoding of newline character with Yaml backend [#3479 state…
…:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
@joliss

This comment has been minimized.

Show comment
Hide comment
@joliss

joliss Feb 18, 2012

Contributor

As you said, setting the Date header is not Rails responsibility

Is it not? The thin people don't think it's their responsibility either: https://thin.lighthouseapp.com/projects/7212/tickets/89-date-header-missing

I wonder, is there any harm in always setting a Date header (with or without expires_in even)? RFC 2616 seems to pretty much say it should be there unconditionally: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18

Contributor

joliss commented Feb 18, 2012

As you said, setting the Date header is not Rails responsibility

Is it not? The thin people don't think it's their responsibility either: https://thin.lighthouseapp.com/projects/7212/tickets/89-date-header-missing

I wonder, is there any harm in always setting a Date header (with or without expires_in even)? RFC 2616 seems to pretty much say it should be there unconditionally: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18

@joliss

This comment has been minimized.

Show comment
Hide comment
@joliss

joliss Feb 18, 2012

Contributor

Oh, and why I care about this obscure Date header thing? Because like @arvida I use CloudFront, which ignores max-age if I don't have the Date set.

For me this got triggered with a Sinatra app, but from this pull request it seems to me this might apply to Rails as well.

Contributor

joliss commented Feb 18, 2012

Oh, and why I care about this obscure Date header thing? Because like @arvida I use CloudFront, which ignores max-age if I don't have the Date set.

For me this got triggered with a Sinatra app, but from this pull request it seems to me this might apply to Rails as well.

josevalim added a commit that referenced this pull request Feb 18, 2012

@josevalim josevalim merged commit 2f689d4 into rails:master Feb 18, 2012

@arvida

This comment has been minimized.

Show comment
Hide comment
@arvida

arvida Feb 18, 2012

Great, thanks for merging this! 💃

arvida commented Feb 18, 2012

Great, thanks for merging this! 💃

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