Skip to content

Add option to forward cache-control headers to client #112

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

reef-actor
Copy link

Setting $config['allow_client_caching'] = true will forward any provided cache-control headers to the client.
Removing cache-control headers continues to be the default behavior.

@chronic0383
Copy link

Thanks for sharing this, any idea on how to stop the script removing cache-control headers ? I can see using your method above forwards the cache control heads. but i still seem to have two client caching settings, the below appears which using developer tools via chrome, i know your configuration works, as if i remove it, the second cache-control disappears, just need to remove the top one if possible ? Any help would be amazing, thanks

cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
cache-control: public, max-age=7200

@reef-actor
Copy link
Author

reef-actor commented Feb 13, 2019

Using this change and setting $config['allow_client_caching'] = true will mean whatever cache-control headers sent by the destination server are used. If it is not set true then it removes the original cache-control headers and inserts no-store, no-cache, must-revalidate to force no caching. If you want no cache-control headers to be added to the proxied resource and let the browser decide what to do then you would need to remove 'cache-control' from the array on line 44 and the if block starting on line 62

@chronic0383
Copy link

chronic0383 commented Feb 15, 2019

Thank you for your reply, and the information. I must be doing something wrong i seem to be getting two cache-controls one from the orginal server, and the other well i'm trying to fight that one, i must be doing something totally wrong, haha, if i find out i'll post back, again thanks for your help.

These are the two cache controls i get when using chrome developer tools:

cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
cache-control: public, max-age=7200

Sorry found the issue it was my server os adding the second cache-control. Thank you once again for sharing your work and helping.

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

Successfully merging this pull request may close these issues.

2 participants