I executed curl -I domainname
in terminal and got following response :
HTTP/1.1 200 OK
Date: Tue, 21 Apr 2015 15:23:09 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Set-Cookie: PHPSESSID=8i9nold1uq077k5onvrhe8bml7; expires=Tue, 28-Apr-2015 15:23:09 GMT; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: max-age=3600
Pragma: cache
Content-Type: text/html; charset=UTF-8
X-Varnish: 426004
Age: 0
Via: 1.1 varnish-v4
Content-Length: 0
Connection: keep-alive
and
HTTP/1.1 200 OK
Date: Tue, 21 Apr 2015 15:23:06 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Set-Cookie: PHPSESSID=73lrlui1ek9hfbfeasv8kh6qh2; expires=Tue, 28-Apr-2015 15:23:06 GMT; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: max-age=3600
Pragma: cache
Content-Type: text/html; charset=UTF-8
X-Varnish: 426001
Age: 0
Via: 1.1 varnish-v4
Connection: keep-alive
In both response PHPSESSID value is different. What changes need to be done in code so that the value in PHPSESSID remains same for all hits for some limited time.
The site is developed in PHP codeigniter. Have to do this change so that varnish can work. As we see that varnish age = 0 for both hits. It fails to create a cache.
Although when the link is used in browser the sessionID remains same in browser cookie, till the site is browsed and/ or same page is called. Until the browser is closed. But varnish age appears 0 there as well.
Any help, Thank you!