A discussion on a Discourse forum addresses an ArgumentError (comparison of Time with String failed) in the stylesheets_controller.rb file, occurring in a subfolder/reverse proxy setup with Apache or NGINX. pfaffman identifies the issue stems from stylesheet_time being a string instead of a date, leading to a comparison error. They attempted fixes like converting to dates and using begin/rescue, suspecting HTTP_IF_MODIFIED_SINCE might be malformed or not properly passed through the proxy. Christoph notes the issue resolved after enabling force_https in the admin interface, but pfaffman confirms they already have DISCOURSE_FORCE_HTTPS: true. Pete_Bondurant experienced the same issue with NGINX and found that disabling reverse proxy buffering resolved it, while Pete_Bondurant resolved it by downgrading from 3.1.0.beta3 to 3.1.0.beta2. The issue appears isolated to specific setups, possibly due to proxy configurations or changes in underlying gems, and is difficult to debug due to caching.
I have a fairly typical subfolder/reverse proxy setup with Apache as the reverse proxy.
First there were issues with insecure assets, so I forced_https in ENV. Now when retrieving assets like stylesheets/color_definitions_light_7_1_6cfae4de9c47a1b8ed3d5748018236d10ea9107e.css?__ws=site.com
Maybe I’m doing something stupid, but I’m getting this:
ArgumentError (comparison of Time with String failed)
app/controllers/stylesheets_controller.rb:66:in `<='
app/controllers/stylesheets_controller.rb:66:in `show_resource'
app/controllers/stylesheets_controller.rb:19:in `show'
app/controllers/application_controller.rb:414:in `block in with_resolved_locale'
app/controllers/application_controller.rb:414:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:369:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'
if !cache_time.to_date.nil? && !stylesheet_time.to_date.nil?
if (stylesheet_time.to_date <= cache_time.to_date)
return render body: nil, status: 304
end
end
It looks like it’s possible for to_date to turn something that’s truthy into a nil date, I guess.
No. That doesn’t work either. I ended up wrapping the section in a begin/rescue/end.
I’m very confused how this could be affecting only this subfolder/reverse-proxied site.
I had the some problem (also while using the subfolder setup). After fixing an unrelated mixed content warning by setting the force_https setting to true, the issue went away …
I got the exact same issue with NGINX instead of Apache as reverse proxy.
Did you find a solution?
By the way it’s only failed with the Desktop version, no issue at all with the mobile version.
I by pass it by disabling the buffering on the reverse proxy