Skip to content

Commit

Permalink
Merge pull request #3645 from DFE-Digital/746-fix-for-compressed-file…
Browse files Browse the repository at this point in the history
…s-using-frontdoor

Exclude file types from compression for aks
  • Loading branch information
RMcVelia authored Oct 24, 2023
2 parents 45bb74f + b15c016 commit a5d9d91
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ require_relative 'config/environment'
require 'prometheus/middleware/exporter'
require_relative 'lib/rack/deflater_with_exclusions'

EXTENSIONS_TO_EXCLUDE = %w(.jpg .jpeg .png .gif .pdf).freeze
if ENV.has_key?("VCAP_APPLICATION")
EXTENSIONS_TO_EXCLUDE = %w(.jpg .jpeg .png .gif .pdf).freeze
else
EXTENSIONS_TO_EXCLUDE = %w(.jpg .jpeg .png .gif .pdf .jp2 .webp .svg .ttf).freeze
end

use Rack::DeflaterWithExclusions, exclude: proc { |env|
File.extname(env["PATH_INFO"]).in?(EXTENSIONS_TO_EXCLUDE)
Expand Down

0 comments on commit a5d9d91

Please sign in to comment.