Skip to content

Commit

Permalink
Exclude file types from compression for aks
Browse files Browse the repository at this point in the history
  • Loading branch information
RMcVelia committed Oct 23, 2023
1 parent 88622c9 commit b15c016
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 b15c016

Please sign in to comment.