Skip to content

Commit

Permalink
Enable gzip_static and gunzip
Browse files Browse the repository at this point in the history
[#109491060]
  • Loading branch information
RochesterinNYC committed Apr 21, 2016
1 parent 705874c commit 1d0bc9f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Binary file not shown.
24 changes: 24 additions & 0 deletions cf_spec/integration/deploy_staticfile_app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,30 @@
expect(response.headers['Content-Encoding']).to eq('gzip')
end

context 'requesting a non-compressed version of a compressed file' do
context 'with a client that can handle receiving compressed content' do
let(:compressed_flag) { '--compressed' }

it 'returns and handles the file' do
expect(app).to be_running

content = `curl #{compressed_flag} http://#{browser.base_url}/war_and_peace.txt`
expect(content).to include("Leo Tolstoy")
end
end

context 'with a client that cannot handle receiving compressed content' do
let(:compressed_flag) { '' }

it 'returns and handles the file' do
expect(app).to be_running

content = `curl #{compressed_flag} http://#{browser.base_url}/war_and_peace.txt`
expect(content).to include("Leo Tolstoy")
end
end
end

context 'with a cached buildpack', :cached do
it 'logs the files it downloads' do
expect(app).to have_logged(/Downloaded \[file:\/\/.*\]/)
Expand Down
2 changes: 2 additions & 0 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ http {
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gunzip on;
gzip_static always;
gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss;

tcp_nopush on;
Expand Down

0 comments on commit 1d0bc9f

Please sign in to comment.