#207 √ invalid
David Lee

cache_action caches 401 responses for pre-basic-auth actions

Reported by David Lee | March 13th, 2008 @ 01:11 AM | in 0.9.4

cache_action causes 401 responses (response for pages restricted with basic authentication) to be cached. If this happens, the cached 401 response will be returned even if proper authorization headers are provided.

Comments and changes to this ticket

  • booss

    booss March 25th, 2008 @ 02:45 AM

    Hi David,

    Thanks for your reporting.

    Could you please explain further your scenario ?

    Is it possible to extract the code of your controller where the basic auth and caching is done ?

    Thanks.

  • David Lee

    David Lee March 25th, 2008 @ 04:28 AM

    It's very simple:

    basic auth is done through merb.yml:

    :basic_auth:

    :username: user

    :password: pw

    :domain: 'mydomain.com'

    and this entry in app/controller/application.rb:

    before :basic_authentication

    caching is done in the controller via cache_action:

    cache_action :index, :show

  • booss

    booss March 25th, 2008 @ 09:51 AM

    It should be fixed by now.

    But the basic_authentification filter should halt the filter chain in order to prevent caching the action.

    Anyway, I also added a method called abort_cache_action if you want to abort caching it while it's being rendered.

  • Michael Klishin (antares)

    Michael Klishin (antares) May 2nd, 2008 @ 08:47 AM

    We are trying to get rid of obsolete tickets. Does this issue still reproduce? Please step up and comment ;)

    Thank you very much for cooperation.

  • booss

    booss May 2nd, 2008 @ 12:00 PM

    Yes. Only 200 responses are being cached.

    Cheers.

  • Michael Klishin (antares)

    Michael Klishin (antares) May 11th, 2008 @ 03:01 PM

    • → Milestone changed from “” to “0.9.4”
    • → State changed from “new” to “open”
  • Michael D. Ivey (ivey)

    Michael D. Ivey (ivey) June 12th, 2008 @ 12:57 AM

    • → State changed from “open” to “invalid”

    It sounds like this is resolved, and also should be in merb-more. I'm closing it, but if anyone is still seeing this, please open a new ticket in merb-more.

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »