Remove ETags based on version for now
This commit is contained in:
parent
30447f6e68
commit
41d406bb19
|
@ -42,19 +42,17 @@ class Travis::Web::App
|
||||||
builder.use Rack::Protection::FrameOptions
|
builder.use Rack::Protection::FrameOptions
|
||||||
builder.use Rack::Protection::PathTraversal
|
builder.use Rack::Protection::PathTraversal
|
||||||
builder.use Rack::ConditionalGet
|
builder.use Rack::ConditionalGet
|
||||||
builder.use Travis::Web::App::AltVersions
|
|
||||||
builder.run new(options)
|
builder.run new(options)
|
||||||
builder.to_app
|
builder.to_app
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :routers, :version, :age, :options, :root, :server_start
|
attr_reader :routers, :age, :options, :root, :server_start
|
||||||
|
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
@options = options
|
@options = options
|
||||||
@server_start = options.fetch(:server_start)
|
@server_start = options.fetch(:server_start)
|
||||||
@root = options.fetch(:root)
|
@root = options.fetch(:root)
|
||||||
@version = File.read File.expand_path('version', root)
|
|
||||||
@age = 60 * 60 * 24 * 365
|
@age = 60 * 60 * 24 * 365
|
||||||
@routers = { default: create_router }
|
@routers = { default: create_router }
|
||||||
end
|
end
|
||||||
|
@ -88,8 +86,7 @@ class Travis::Web::App
|
||||||
'Cache-Control' => cache_control(file),
|
'Cache-Control' => cache_control(file),
|
||||||
'Content-Location' => path_for(file),
|
'Content-Location' => path_for(file),
|
||||||
'Content-Type' => mime_type(file),
|
'Content-Type' => mime_type(file),
|
||||||
'Expires' => (server_start + age).httpdate,
|
'Expires' => (server_start + age).httpdate
|
||||||
'ETag' => %Q{"#{version}"}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
set_config(content, options) if config_needed?(file)
|
set_config(content, options) if config_needed?(file)
|
||||||
|
@ -100,7 +97,6 @@ class Travis::Web::App
|
||||||
'Cache-Control' => cache_control(file),
|
'Cache-Control' => cache_control(file),
|
||||||
'Content-Location' => path_for(file),
|
'Content-Location' => path_for(file),
|
||||||
'Content-Type' => mime_type(file),
|
'Content-Type' => mime_type(file),
|
||||||
'ETag' => %Q{"#{version}"},
|
|
||||||
'Last-Modified' => server_start.httpdate,
|
'Last-Modified' => server_start.httpdate,
|
||||||
'Expires' => (server_start + age).httpdate,
|
'Expires' => (server_start + age).httpdate,
|
||||||
'Vary' => vary_for(file)
|
'Vary' => vary_for(file)
|
||||||
|
@ -130,7 +126,6 @@ class Travis::Web::App
|
||||||
def cache_control(file)
|
def cache_control(file)
|
||||||
case path_for(file)
|
case path_for(file)
|
||||||
when '/' then "public, must-revalidate"
|
when '/' then "public, must-revalidate"
|
||||||
when '/version' then "no-cache"
|
|
||||||
else "public, max-age=#{age}"
|
else "public, max-age=#{age}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -138,7 +133,6 @@ class Travis::Web::App
|
||||||
def vary_for(file)
|
def vary_for(file)
|
||||||
case path_for(file)
|
case path_for(file)
|
||||||
when '/' then 'Accept'
|
when '/' then 'Accept'
|
||||||
when '/version' then '*'
|
|
||||||
else ''
|
else ''
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user