diff --git a/app/controllers/admin/archived/petitions_controller.rb b/app/controllers/admin/archived/petitions_controller.rb index bffeb22a0..22e364ef4 100644 --- a/app/controllers/admin/archived/petitions_controller.rb +++ b/app/controllers/admin/archived/petitions_controller.rb @@ -112,9 +112,9 @@ def set_file_headers end def set_streaming_headers - #nginx doc: Setting this to "no" will allow unbuffered responses suitable for Comet and HTTP streaming applications - headers['X-Accel-Buffering'] = 'no' + headers["X-Accel-Buffering"] = "no" headers["Cache-Control"] ||= "no-cache" + headers["Last-Modified"] = Time.current.httpdate headers.delete("Content-Length") end diff --git a/app/controllers/admin/petitions_controller.rb b/app/controllers/admin/petitions_controller.rb index 1c473cff4..2328d261a 100644 --- a/app/controllers/admin/petitions_controller.rb +++ b/app/controllers/admin/petitions_controller.rb @@ -95,9 +95,9 @@ def set_file_headers end def set_streaming_headers - #nginx doc: Setting this to "no" will allow unbuffered responses suitable for Comet and HTTP streaming applications - headers['X-Accel-Buffering'] = 'no' + headers["X-Accel-Buffering"] = "no" headers["Cache-Control"] ||= "no-cache" + headers["Last-Modified"] = Time.current.httpdate headers.delete("Content-Length") end diff --git a/spec/controllers/admin/archived/petitions_controller_spec.rb b/spec/controllers/admin/archived/petitions_controller_spec.rb index 2c9e99fb4..c8e0ae4b1 100644 --- a/spec/controllers/admin/archived/petitions_controller_spec.rb +++ b/spec/controllers/admin/archived/petitions_controller_spec.rb @@ -69,8 +69,9 @@ end it "sets the streaming headers" do - expect(response["Cache-Control"]).to match(/no-cache/) expect(response["X-Accel-Buffering"]).to eq("no") + expect(response["Cache-Control"]).to match(/no-cache/) + expect(response["Last-Modified"]).to match(/\w{3}, \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} GMT/) end it "sets the content disposition" do diff --git a/spec/controllers/admin/petitions_controller_spec.rb b/spec/controllers/admin/petitions_controller_spec.rb index c39d403f4..a4c53e9cf 100644 --- a/spec/controllers/admin/petitions_controller_spec.rb +++ b/spec/controllers/admin/petitions_controller_spec.rb @@ -65,8 +65,9 @@ end it "sets the streaming headers" do - expect(response["Cache-Control"]).to match(/no-cache/) expect(response["X-Accel-Buffering"]).to eq("no") + expect(response["Cache-Control"]).to match(/no-cache/) + expect(response["Last-Modified"]).to match(/\w{3}, \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} GMT/) end it "sets the content disposition" do