Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/controllers/users/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@ def destroy
end

def active
response.headers['Etag'] = '' # clear etags to prevent caching
session[:pinged_at] = now
Rails.logger.debug(alive?: alive?, expires_at: expires_at)
render json: { live: alive?, timeout: expires_at, remaining: remaining_session_time }
end

def keepalive
response.headers['Etag'] = '' # clear etags to prevent caching
session[:session_expires_at] = now + Devise.timeout_in if alive?
analytics.session_kept_alive if alive?

Expand Down
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ class Application < Rails::Application
}
config.action_mailer.observers = %w[EmailDeliveryObserver]

config.middleware.delete Rack::ETag

require 'headers_filter'
config.middleware.insert_before 0, HeadersFilter
require 'utf8_sanitizer'
Expand Down
12 changes: 0 additions & 12 deletions spec/controllers/users/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
expect(response.status).to eq(200)
end

it 'clears the Etag header' do
get :active

expect(response.headers['Etag']).to eq ''
end

it 'renders json' do
get :active

Expand Down Expand Up @@ -675,12 +669,6 @@
expect(response.status).to eq(200)
end

it 'clears the Etag header' do
post :keepalive

expect(response.headers['Etag']).to eq ''
end

it 'renders json' do
post :keepalive

Expand Down