Prefer remote_ip in GaEventsController (#19074)

This commit is contained in:
Mac Siri 2023-02-06 18:38:00 -05:00 committed by GitHub
parent cb3b12feaa
commit cb2477a991
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View file

@ -238,7 +238,7 @@ class ApplicationController < ActionController::Base
end
def anonymous_user
User.new(ip_address: request.env["HTTP_FASTLY_CLIENT_IP"] || request.env["HTTP_X_FORWARDED_FOR"])
User.new(ip_address: request.env["HTTP_FASTLY_CLIENT_IP"] || request.remote_ip)
end
def initialize_stripe

View file

@ -31,7 +31,7 @@ class GaEventsController < ApplicationController
def scrambled_ip
crypt = ActiveSupport::MessageEncryptor.new(todays_key)
crypt.encrypt_and_sign(request.env["HTTP_X_FORWARDED_FOR"] || request.remote_ip)
crypt.encrypt_and_sign(request.env["HTTP_FASTLY_CLIENT_IP"] || request.remote_ip)
end
def todays_key

View file

@ -27,6 +27,7 @@ describe('play or pause animated images', () => {
describe('no reduced motion preference', () => {
beforeEach(() => {
cy.testSetup();
Cypress.on('window:before:load', (window) => {
window.document.body = generateFakePageBody();
});