Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

default_url_options set within a controller are not cleared after every request on production

#6131

With Rails 3.0.3: default_url_options set from within a controller (default_url_options[:something] = "value") won't be cleared after each request in a production environment. Once set, the option will be used until overwritten or explicitly removed. In development mode though, the option is dropped after each request.

For instance, we are using code like this:

  class ApplicationController
    before_filter :set_session_id_parameter
    def set_session_id_parameter
      if device_needs_session_param_in_url?
         session[:_dummy_param_to_force_session_init] = nil  # to make sure we have a session id
         key = Rails.application.config.session_options[:key]
         default_url_options[key] = request.session_options[:id]
      end
    end
  end

In development mode this works fine. But within a production environment (class caching enabled) the session ID parameter once set will stay for all subsequent requests until overwritten again. This was unexpected behavior for us. I also can't find any documentation indicating that this would be the case.

Reported by Michael Reinsch · December 8th, 2010 @ 05:52 AM

State: new
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Manfred Stienstra
    Manfred Stienstra
    • Importance changed from to Low

    Correct, this is exactly what they're supposed to do.

    February 25th, 2011 @ 10:43 AM