mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #8242 from sminnee/simpler-vary-header
FIX: Remove X-Requested-With from default Vary header.
This commit is contained in:
commit
13e8b155ec
@ -16,7 +16,7 @@ HTTP:
|
||||
no-cache: "true"
|
||||
no-store: "true"
|
||||
must-revalidate: "true"
|
||||
vary: "X-Requested-With, X-Forwarded-Protocol"
|
||||
vary: "X-Forwarded-Protocol"
|
||||
LeftAndMain:
|
||||
dependencies:
|
||||
versionProvider: %$SilverStripeVersionProvider
|
||||
|
@ -918,6 +918,9 @@ class Director implements TemplateGlobalProvider {
|
||||
* by checking for a custom header set by jQuery or
|
||||
* wether a manually set request-parameter 'ajax' is present.
|
||||
*
|
||||
* Note that if you plan to use this to alter your HTTP response on a cached page,
|
||||
* you should add X-Requested-With to the Vary header.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function is_ajax() {
|
||||
|
@ -209,7 +209,7 @@ when calculating a cache key, usually in addition to the full URL path.
|
||||
By default, SilverStripe will output a `Vary` header with the following content:
|
||||
|
||||
```
|
||||
Vary: X-Requested-With, X-Forwarded-Protocol
|
||||
Vary: X-Forwarded-Protocol
|
||||
```
|
||||
|
||||
To change the value of the `Vary` header, you can change this value by specifying the header in configuration.
|
||||
@ -218,3 +218,6 @@ To change the value of the `Vary` header, you can change this value by specifyin
|
||||
HTTP:
|
||||
vary: ""
|
||||
```
|
||||
|
||||
Note that if you use `Director::is_ajax()` on cached pages then you should add `X-Requested-With` to the vary
|
||||
header.
|
||||
|
@ -77,7 +77,6 @@ class HTTPTest extends FunctionalTest {
|
||||
$this->assertNotEmpty($v);
|
||||
|
||||
$this->assertContains("X-Forwarded-Protocol", $v);
|
||||
$this->assertContains("X-Requested-With", $v);
|
||||
$this->assertNotContains("Cookie", $v);
|
||||
$this->assertNotContains("User-Agent", $v);
|
||||
$this->assertNotContains("Accept", $v);
|
||||
|
Loading…
Reference in New Issue
Block a user