Questions tagged [vary]

The Vary response header is used for indicating to browsers and other user agents which request header values to check when deciding whether to load content from a cache or to instead fetch a new response over the network.

The Vary header is defined in RFC 7231 http://httpwg.org/specs/rfc7231.html#header.vary. Its value is a list of header names. Here’s a simple example of how it works:

  1. Code running in a browser at https://origin-a.com makes a request to https://some-server.com/some/path with the request header Origin: https://origin-a.com.
  2. The https://some-server.com server sends back the response with the content from /some/path and the response header Vary: Origin.
  3. A browser receives the response and caches the content from /some/path.
  4. Code running in the browser at https://origin-b.com makes a request to https://some-server.com/some/path with the request header Origin: https://origin-b.com.
  5. The browser sees that the Origin request-header value for the code from https://origin-b.com is different from that of https://origin-a.com, so instead of using the /some/path content it cached previously, the browser fetches a new response from https://some-server.com/some/path over the network.

For more details, see the following:

41 questions
2
votes
1 answer

Htaccess vary header with inconsistency issue

can anyone point out what is wrong with my htaccess coding? I am getting errors: This response is negotiated, but doesn't have an appropriate Vary header. The resource doesn't send Vary consistently. ## add vary header
user3108698
  • 681
  • 3
  • 8
  • 22
2
votes
1 answer

perl seek and remove at varying offsets in binmode

This is my script I am writing. #usr/bin/perl use warnings; open(my $infile, '<', "./file1.bin") or die "Cannot open file1.bin: $!"; binmode($infile); open(my $outfile, '>', "./extracted data without 00's.bin") or die "Cannot create extracted data…
james28909
  • 554
  • 2
  • 9
  • 20
2
votes
3 answers

Vary Accept-Encoding header don't works

I added next lines in .htaccess, which I found here How to specify vary accept encoding header in htaccess Header append Vary Accept-Encoding
AlexZd
  • 2,152
  • 2
  • 18
  • 29
1
vote
0 answers

Reduce number of preflight requests for Azure Storage Services Rest API

I am uploading my files in Azure Blob Storage using Azure Blob Rest API. I break my file in multiple chunks and upload all chunks 1 by 1 using Put Block rest API. At times if a file is over 1 GB, I have to make more than 100 API calls to completely…
Asad Ullah
  • 2,257
  • 2
  • 24
  • 23
1
vote
2 answers

Google Cloud CDN vary:cookie response never gets cache hit

I'm using Google Cloud CDN to cache an HTML page. I've configured all the correct headers as per the docs, and the page is caching fine. Now, I want to change it so that it only caches when the request has no cookies, i.e. no cookie header set. My…
davnicwil
  • 28,487
  • 16
  • 107
  • 123
1
vote
2 answers

.net core UseResponseCompression conflicts with ResponseCache attribute when putting Vary header values

I am using the Response Compression Middleware in my .Net Core API application by calling app.UseResponseCompression(). But in one of my API controller actions, I'm also using ResponseCache attribute and setting it to VaryByHeader =…
gdl123
  • 33
  • 4
1
vote
0 answers

How to configure Varnish to conditionally ignore cookie based on Vary response header?

I'm using Varnish 3 for caching responses from a web application that uses Edge Side Includes (ESI). There are generally two types of responses from ESI endpoints: some are authentication-specific, responses thus use Vary: Cookie,…
MicE
  • 5,038
  • 2
  • 29
  • 26
1
vote
1 answer

Should I specify "Vary: If-None-Match, If-Modified-Since"?

RFC 7231: The "Vary" header field in a response describes what parts of a request message, aside from the method, Host header field, and request target, might influence the origin server's process for selecting and representing this response.
Max Yaskov
  • 314
  • 1
  • 11
1
vote
1 answer

MVC asp.net OutputCache Vary header missing from response

When I use Response.Cache.SetCacheability(HttpCacheability.Private) and Response.Cache.VaryByHeaders["someValue"] = true; the Vary header is missing from the response! There is NO problem with the…
J.P.
  • 21
  • 5
1
vote
0 answers

VARY Header in HTTP Request

What is the use of VARY header in HTTP request? I am unable to understand the use of VARY header for cross domain and cache control. Any suggestions is appreciated.
AAaa
  • 51
  • 1
  • 3
1
vote
0 answers

Doing it right with Google SEO while Dynamically Serving between desktop and mobile

I've read the whole thing here on dynamic serving and I understood that setting the correct-http-headers is the key here! My game plan is simple; I will have a single url as ".com/myApp" and then I will serve my content dynamically. As a result, …
Average Joe
  • 4,521
  • 9
  • 53
  • 81
1
vote
1 answer

Why does the file size matter for apache command Header append Vary User-Agent to trigger?

I'm using symfony 3, and have the following .htaccess file (attached to the very bottom of this message noted as 'problem .htaccess'). I'm using the website gtmetrix.com (which uses pagespeed) to optimize my site, but I'm getting the following…
Joseph Astrahan
  • 8,659
  • 12
  • 83
  • 154
1
vote
0 answers

set vary header in tomcat web server?

how i can specify vary header in tomcat? what's the difference between vary header:user agent and vary header:accept encoding. i just enabled Gzip compression in tomcat for .XHR format file.but it didn't work. i used this MIME…
1
vote
1 answer

How to set up Vary HTTP header in Symfony2 web app?

In my Symfony2 web app, I need to set up Vary HTTP header for User-Agent, like in this link, https://developers.google.com/webmasters/smartphone-sites/details?hl=en Does any know how to do this ?
jef
  • 55
  • 9
1
vote
1 answer

How can I vary the colour of a point on a scatter-graph in VBA/Excel as a function of the X, Y co-ordinates of the point itself?

I am developing an Excel-based simulator that runs a specific test 1,000 times. The result of each test is two co-ordinates. These co-ordinates are written to a range. I then create an X-Y Scatter graph based on that range. What I now wish to do is…
user2723257
  • 13
  • 1
  • 3