Skip to content

Commit

Permalink
Release #1098
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr0grog committed Mar 30, 2023
2 parents 877ce5a + e85d7f6 commit 9bdd7ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/api/v0/diff_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ class Api::V0::DiffController < Api::V0::ApiController
def show
ensure_diffable

# Some front-end caches, like CloudFront, need the headers from *both*
# expires_in and stale? to cache most effectively.
unless Rails.env.development?
cache_time = params[:diff_version] ? 100.years : 1.day
expires_in(cache_time, public: true, stale_while_revalidate: 7.days, stale_if_error: 7.days)
end
if stale?(etag: diff_etag, last_modified: Differ.cache_date, public: true)
render json: {
links: {
Expand Down

0 comments on commit 9bdd7ce

Please sign in to comment.