Apache redirect and set cache headers?

288

Try adding the "always" condition to your Header directive, so it should look like this:

Header always set Cache-Control max-age=0
Header always set Expires "Thu, 01 Dec 1994 16:00:00 GMT"

This should work, without the "always" condition I believe it defaults to "onsuccess" which is defined as any 2xx response code.

Share:
288

Related videos on Youtube

Rémi
Author by

Rémi

Updated on September 17, 2022

Comments

  • Rémi
    Rémi over 1 year

    I have the following piece of code :

    private List<KeyValuePair<int, string>> _list = new List<KeyValuePair<int, string>>();
    
    public MyclassConstructor()
    {
        foreach (Enum value in Enum.GetValues(typeof(FontStyle)))
            _list.Add(new KeyValuePair<int, string>((int)value, value.ToString()));
    }
    

    I can't figure out how to get the int part of this enum as the key... pretty dumb question I'm sure but I can't get it working.

    I was refering to this article up here on stackoverflow but as you can see this doesn't work

    So how can I get the int value of the enum?

    Edit : When I try to compile I got the following error message "Cannot convert type 'System.Enum' to 'int'"

    • Bill Gregg
      Bill Gregg almost 11 years
      Casting the value as an int should take care of it. Surprised that isn't working.
    • Rémi
      Rémi almost 11 years
      @DanJ Sorry, it simply doesn't compile with the error message "Cannot convert type 'System.Enum' to 'int'". I will edit the question
  • Jakob Borg
    Jakob Borg over 13 years
    Not pretty indeed, I'm pretty surprised this isn't doable in a better way (directly in the configuration), but this looks like a correct answer. :(
  • Jakob Borg
    Jakob Borg over 13 years
    !!! Don't know how I missed this, but yes!
  • Cosimo
    Cosimo almost 11 years
    Yes, this is it. Great.
  • Dan J
    Dan J almost 11 years
    Sorry, it isn't clear: what isn't working in the code above? Also, could you make the KeyValuePair's key type FontStyle instead of int?
  • Rémi
    Rémi almost 11 years
    This was it... Just fix typo FontStylevalue to FontStyle value and I will mark as answer as soon as I will be able to do so
  • juan
    juan almost 11 years
    This doesn't seem to work for custom headers, strange