diff --git a/app/controllers/user_avatars_controller.rb b/app/controllers/user_avatars_controller.rb index 271cd412571..39050be70bd 100644 --- a/app/controllers/user_avatars_controller.rb +++ b/app/controllers/user_avatars_controller.rb @@ -173,7 +173,7 @@ class UserAvatarsController < ApplicationController def render_blank path = Rails.root + "public/images/avatar.png" expires_in 10.minutes, public: true - response.headers["Last-Modified"] = 10.minutes.ago.httpdate + response.headers["Last-Modified"] = Time.new('1990-01-01').httpdate response.headers["Content-Length"] = File.size(path).to_s send_file path, disposition: nil end diff --git a/spec/requests/user_avatars_controller_spec.rb b/spec/requests/user_avatars_controller_spec.rb index 73bbfe16cf0..5e8d0e79b09 100644 --- a/spec/requests/user_avatars_controller_spec.rb +++ b/spec/requests/user_avatars_controller_spec.rb @@ -107,7 +107,9 @@ describe UserAvatarsController do get "/user_avatar/default/xxx/51/777.png" expect(response.status).to eq(200) - expect(response.headers["Last-Modified"]).to eq(10.minutes.ago.httpdate) + + # this image should be really old so when it is fixed various algorithms pick it up + expect(response.headers["Last-Modified"]).to eq(Time.new('1990-01-01').httpdate) end it 'serves image even if size missing and its in local mode' do