Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the Vary and Cache-Control headers to be modified. #555

Merged
merged 2 commits into from
Jun 15, 2018

Conversation

donnchawp
Copy link
Contributor

Fixes #523 and #522
Define the constants WPSC_VARY_HEADER and WPSC_CACHE_CONTROL_HEADER to
override the default Vary and Cache-Control headers.
If the Vary header doesn't include Accept-Encoding visitors may get
mixed compressed or not pages.
If it is missing Cookie the wrong file might be sent to anonymous users.

Fixes #523 and #522
Define the constants WPSC_VARY_HEADER and WPSC_CACHE_CONTROL_HEADER to
override the default Vary and Cache-Control headers.
If the Vary header doesn't include Accept-Encoding visitors may get
mixed compressed or not pages.
If it is missing Cookie the wrong file might be sent to anonymous users.
@donnchawp donnchawp self-assigned this May 15, 2018
@kasperkamperman
Copy link

Any documentation on this point. How do I add this to my wp-config?

WPSC_VARY_HEADER = true? Or something?

@donnchawp
Copy link
Contributor Author

You define WPSC_VARY_HEADER and WPSC_CACHE_CONTROL_HEADER by setting the string that should be sent for each header. For example:
define( 'WPSC_VARY_HEADER', 'Accept-Encoding, Cookie' );
define( 'WPSC_CACHE_CONTROL_HEADER', 'max-age=3, must-revalidate' );

If you set them to a blank string then that header won't be used.

@donnchawp donnchawp merged commit a7a5e92 into master Jun 15, 2018
@donnchawp donnchawp deleted the 523_headers_control branch June 15, 2018 13:26
@kporembinski
Copy link

I have set:

define( 'WPSC_CACHE_CONTROL_HEADER', 'max-age=3600, must-revalidate' );

and it is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants