Skip to content

Improve cache flags. Proper id on auth errors #309

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

Merged
merged 2 commits into from
Dec 6, 2022
Merged

Conversation

ryanmelt
Copy link
Member

@ryanmelt ryanmelt commented Dec 4, 2022

No description provided.

@ryanmelt ryanmelt requested a review from jmthomas December 4, 2022 22:08
Copy link
Member

@jmthomas jmthomas left a comment

Choose a reason for hiding this comment

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

Fix unit tests

id = Integer(parsed['id'])
rescue
OpenC3::Logger.warn("Unable to extract id from JSON-RPC message")
end
Copy link
Member

Choose a reason for hiding this comment

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

I assume you ran into this condition somehow?

@@ -73,7 +73,7 @@ def self.get_cache_control(filename)
has_version_number = /(-|_|\.)\d+(-|_|\.)\d+(-|_|\.)\d+\./.match(filename)
has_content_hash = /\.[a-f0-9]{20}\./.match(filename)
return nil if has_version_number or has_content_hash
return 'no-cache'
return 'no-cache, max-age=3600'
Copy link
Member

@jmthomas jmthomas Dec 5, 2022

Choose a reason for hiding this comment

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

I had to look this stuff up: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#request_directives
The no-cache request directive asks caches to validate the response with the origin server before reuse. The max-age=N request directive indicates that the client allows a stored response that is generated on the origin server within N seconds — where N may be any non-negative integer (including 0).

So basically we're saying we allow the server to use a stored response that's less than 1hr old but we always want that response from the server (no local caching). Is that right?

@ryanmelt ryanmelt merged commit 45ec57d into main Dec 6, 2022
@ryanmelt ryanmelt deleted the caching_and_auth_error branch December 6, 2022 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants