I faced strange issue in production (I can't reproduce it in development mode).
Steps:
- Go to site: browser loads site, all assets it's ok
- Refresh page: browser checks assets changes with GET request with If-Modified-Since header
- Server responses with 500
Rack::Lint::LintError at /assets/active_admin-5e156170588231ea208a6443d45bb66c.css Content-Type header found in 304 response, not allowed
Something strange:
Response contains header Content-Type:text/html for both JS and CSS assets. When browser makes request without If-Modified-Since header, response's Content-Type is correct.
Stack trace:
/usr/local/lib/ruby/gems/2.1.0/gems/rack-1.6.0/lib/rack/lint.rb: in assert raise LintError, message...
/usr/local/lib/ruby/gems/2.1.0/gems/rack-1.6.0/lib/rack/lint.rb: in block in check_content_type assert("Content-Type header found in #{status} response, not allowed") {...
/usr/local/lib/ruby/gems/2.1.0/gems/rack-1.6.0/lib/rack/lint.rb: in each headers.each { |key, value|...
/usr/local/lib/ruby/gems/2.1.0/gems/rack-1.6.0/lib/rack/lint.rb: in check_content_type headers.each { |key, value|...
/usr/local/lib/ruby/gems/2.1.0/gems/rack-1.6.0/lib/rack/lint.rb: in _call check_content_type status, headers...
/usr/local/lib/ruby/gems/2.1.0/gems/rack-1.6.0/lib/rack/lint.rb: in call dup._call(env)...
/usr/local/lib/ruby/gems/2.1.0/gems/rack-1.6.0/lib/rack/showexceptions.rb: in call @app.call(env)...
/usr/local/lib/ruby/gems/2.1.0/gems/rack-1.6.0/lib/rack/commonlogger.rb: in call status, header, body = @app.call(env)...
/usr/local/lib/ruby/gems/2.1.0/gems/rack-1.6.0/lib/rack/chunked.rb: in call status, headers, body = @app.call(env)...
/usr/local/lib/ruby/gems/2.1.0/gems/rack-1.6.0/lib/rack/content_length.rb: in call status, headers, body = @app.call(env)...
/usr/local/lib/ruby/gems/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb: in process_client status, headers, body = @app.call(env = @request.read(client))...
/usr/local/lib/ruby/gems/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb: in worker_loop process_client(client)...
/usr/local/lib/ruby/gems/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb: in spawn_missing_workers worker_loop(worker)...
/usr/local/lib/ruby/gems/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb: in start spawn_missing_workers...
/usr/local/lib/ruby/gems/2.1.0/gems/unicorn-4.8.3/bin/unicorn: in <top (required)> Unicorn::HttpServer.new(app, options).start.join...
/usr/local/bin/unicorn: in load load Gem.bin_path('unicorn', 'unicorn', version)...
/usr/local/bin/unicorn: in <main> load Gem.bin_path('unicorn', 'unicorn', version)
Gemfile:
# Rails
gem 'rails', '~> 4.2.1'
gem 'active_model_serializers', '~> 0.9.3'
# Server
gem 'unicorn', '~> 4.8.3'
# Views and Assets engines
gem 'sass-rails', '~> 5.0.1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'chosen-rails', '~> 1.3.0'
gem 'therubyracer', '~> 0.12.1', platform: :ruby
# ActiveAdmin
gem 'activeadmin', github: 'activeadmin/activeadmin', branch: :master, ref: '7aef260921d418d904d2dba9b1a97eed893e9019'
gem 'status_tag_for'
# Authentication
gem 'devise', '~> 3.4.1'
# Settings
gem 'settingslogic', '~> 2.0.9'
# Database
gem 'pg', '~> 0.18.1'
# Other
gem 'semantic', '~> 1.4.0'
group :test, :development do
# Spec
gem 'rspec', '~> 3.2.0', require: false
gem 'rspec-rails', '~> 3.2.0', require: false
# Quiet Assets
gem 'quiet_assets', '~> 1.0.3'
# OSS licenses management
# without require: false breaks AR see: https://github.com/rails/arel/issues/133
gem 'license_finder', require: false
end
group :test do
# Mocks
gem 'vcr', '~> 2.9', require: false
gem 'webmock', '~> 1.17', require: false
gem 'factory_girl_rails', '~> 4.5.0'
gem 'database_cleaner', '~> 1.3.0'
# Coverage
gem 'simplecov', '~> 0.9.1', require: false
gem 'simplecov-teamcity-summary', '~> 0.1.1', require: false
end
Any ideas?
Thanks