Athlon1600 / php-proxy

A web proxy script written in PHP and built as an alternative to Glype.
https://www.php-proxy.com
MIT License
295 stars 158 forks source link

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

Open reef-actor opened 6 years ago

reef-actor commented 6 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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.