Ticket

Change Vary:* = need Vary:Accept-Encoding

I would like to change how orchard 1.9.1 sets the Vary request header form Vary * to Accept-Encoding. Tried: in web.config and got response headers of both * and Accept-Encoding. I serve gzip static files from AWS cloud front and to cache these files for users I need a Accept-Encoding Header as Vary: Accept-Encoding This somewhat works to give the header Accept-Encoding: gzip,deflate; but it does not work with a Vary header of Vary:*

<add name="Accept-Encoding" value="gzip,deflate" /> `` Still it does not cache these resources on users machines without the proper Vary header.

But when add

<remove name="Vary" /> ``

And add

<add name="Vary" value="Accept-Encoding" /> ``

With

<add name="Accept-Encoding" value="gzip,deflate" /> ``

Then I get a static file error on my sites and a Vary response header of Vary: *,Accept-Encoding,Accept-Encoding

NO settings in Orchard cache to change Vary to anything it will stay Vary:* no matter what, and you cannot change it or fix it in the web config or anywhere else

Re: Change Vary:* = need Vary:Accept-Encoding

I don't remember all details around this, but see here where i was saying this:

I have also reintroduced line 497 : response.Cache.SetOmitVaryStar(true);
Because the use of the vary:* header can disable all client caching
I had the case with a local ASP server, but not with iis Express...

So, in Orchard.OutputCache/Filters/OutputCacheFilter.cs, try to reintroduce this commented line:

        response.Cache.SetOmitVaryStar(true);

If it fits your need, you may open an issue on github, then i could do a PR...

Best

Thursday, January 28, 2016 12:51:46 AM byjtkech
  • jtkech
  • Lv. 13 Rookie
  • Total EXP: 1028

Re: Change Vary:* = need Vary:Accept-Encoding

Looked a dev branch of source code and it is still the same. The deployed source and 1.9.2 sets a response header of Vary*

I am not sure if any of you know what this means = no caching on the client side = so all of your caching work = does not work = supppppper simple; what is wrong you all that you do not understand this.

Search google for Vary*

One problem is none of you try or test orchard in real world, like on a share server where you do not have access to server variables or being able to change things like in IIS or with Apache htaccess or like on Azure where you have control over response headers. You make orchard for developers not for normal people who do not want there life consumed by Visual Studio.

Saturday, January 30, 2016 6:19:49 PM bydonaldboulton

Re: Change Vary:* = need Vary:Accept-Encoding

I've no fixed opinion because i've learned so much with Orchard... But sincerely, i fully understand what you mean. A great work has been done on caching, e.g on server side. But, indeed, here there is still an issue, maybe because of a little mix between Request and Response headers...

That said, as a workaround without modifying the source code, try to add this in your rootweb.config at the end of your system.web section (not the system.webServer section):

<system.web>
...
...
    <caching>
        <outputCache omitVaryStar="true"></outputCache>
    </caching>
</system.web>

Best

Sunday, January 31, 2016 1:29:32 AM byjtkech
  • jtkech
  • Lv. 13 Rookie
  • Total EXP: 1028

Re: Change Vary:* = need Vary:Accept-Encoding

Should be done like this and it does not change; I still get Vary * in response headers.

<caching> ` <outputCacheProfiles>` <outputCache omitVaryStar="true" /> ` </outputCacheSettings> `
</caching> `</system.web>`

Wednesday, February 3, 2016 9:20:00 PM bydonaldboulton

Re: Change Vary:* = need Vary:Accept-Encoding

If i do it like this it doesn't work, but if <outputCache> is a direct child of <caching> it works.

See here, in the parent elements you only have: configuration, system.web and caching.

Best.

Wednesday, February 3, 2016 9:32:04 PM byjtkech
  • jtkech
  • Lv. 13 Rookie
  • Total EXP: 1028

Re: Change Vary:* = need Vary:Accept-Encoding

Below are Response headers from Orchard Pros and Git hub indicate Vary by something other than Vary. Vary by * it tells the server to do what it wants, "A BIG MAYBE" with encoding and cache control, Sometimes I get, Cache Control public max age= value, and sometimes I get Cache-Control: no-cache, no-store, must-revalidate. Vary just confuses servers. Below shows that someone using Orchard recognizes Vary = Accept-Encoding, with Content-Encoding: gzip just like I need.

Status: HTTP/1.1 200 OK Cache-Control: no-cache, no-store, must-revalidate Pragma: no-cache Content-Length: 7734 Content-Type: text/html; charset=utf-8 Content-Encoding: gzip Expires: -1 Vary: Accept-Encoding Server: Microsoft-IIS/8.0

Now Respone headers from Github

Server: GitHub.com Date: Thu, 04 Feb 2016 11:51:25 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked Connection: close Status: 200 OK Cache-Control: no-cache Vary: X-PJAX ................................

Thursday, February 4, 2016 1:20:46 PM bydonaldboulton

Post a reply

You need to be signed in to post a reply.

Sign In