apache2 - is it possible to cache a php page that have "GET" variables with 'Cache-Control: public, max-age=n' header?
i have this php page that looks like this:
/get_data.php?forid=123&pdid=456&exclude_ids=
it's accessed publicly and return the same content when provided with the same variables -"GET" variables that are included in the link- ,and i can't seem to have the browser cache the page so it won't bother the server every time the page is needed!
I've tried and added this line to the head of get_data.php but no luck
header('Cache-Control: public, max-age=7200');
this is the php file code:
<?php
header('Content-type: application/json');
header('Cache-Control: public, max-age=7200');
require('config.php');
$link_database = new mysqli($host,$dbusername,$dbpassword,$database);
...
?>
accessed like this in javascript:
xmlhttp.open("GET", "/get_data.php?forid="+forid+"&pdid="+pdid+"&exclude_ids="+existing_ids.join(","), true);
tested with firefox i get this raw response headers:
HTTP/1.1 200 OK
Date: Sat, 15 Jun 2019 16:04:54 GMT
Server: Apache/2.4.25 (Debian)
Cache-Control: public, max-age=7200
Keep-Alive: timeout=5, max=91
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json
is what i'm trying to do even a possibility? if it is, how can i?
ps: the php code execute a simple sql, and a pure php cache system will not give any advantages(i think!).