madskristensen / WebEssentials.AspNetCore.OutputCaching

Other
52 stars 17 forks source link

Issue with Redirect response #27

Open hagaygo opened 2 years ago

hagaygo commented 2 years ago

Hi,

The library works fine by caching view responses.

But when my controller returns a redirect response or other code response , it seems no cache is applied.

Am i missing something ? is it by design ? or missing some settings ?

Thanks in advance.

hagaygo commented 2 years ago

Digged a little more on other issues and found an option to make it work :

options.DoesResponseQualify = (context) =>
    {
        return true;
    };

Which i guess allow to cache any response.

hagaygo commented 2 years ago

While it does cache my redirect (302) response , it responds with 200 code and correct headers which in effect is not correct cache (and produce in that a case a not working redirect).

I see the code has some more hard coded behavior regarding 200 response so i guess the library currently does not support caching of this situation.