Control Web Panel
WebPanel => Apache => Varnish => Topic started by: thewebexpert on February 22, 2023, 12:56:44 AM
-
Dear Forum, I hope that you can help me resolve this ... I have activated Nginx & Varnish & Apache, Website when I CURL returns AGE : 0 and i see that Varnish Cache is serving the site
However the test code <?php
echo rand(1, 99);
?>
returns a different number every time, so even through curl shows varnish in the header, varnish is not caching.
I edited he webserver config for the domain and selected Vanish, Selected the Wordpress.tpl file, rebuilt config and the site is up and running. I do not know what is missing, I suppose the website could be very busy and filling the cache perhaps too quickly but doubt that.. help would be great, or at least some hints to where I can look
TTP/1.1 200 OK
Server: nginx/1.22.1
Date: Wed, 22 Feb 2023 00:55:24 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 22
Connection: keep-alive
Keep-Alive: timeout=60
Cache-Control: max-age=0
Expires: Wed, 22 Feb 2023 00:55:24 GMT
Content-Encoding: gzip
X-Varnish: 296099
Age: 0
Via: 1.1 varnish (Varnish/5.2)
-
and your problem solved ?
if so... can we make it for 1 or 2 days /?
-
My problem is not solved, I have varnish enabled but whenever I try the test php page the number is different, meaning the cache is not working.
Still looking for help on how to troubleshoot.
There is a chance that my cache is too small, and the site is too busy so it keeps emptying itself I suppose however I have no clue how to validate that...
anyone????
-
My problem is not solved, I have varnish enabled but whenever I try the test php page the number is different, meaning the cache is not working.
Still looking for help on how to troubleshoot.
There is a chance that my cache is too small, and the site is too busy so it keeps emptying itself I suppose however I have no clue how to validate that...
anyone? ???
the random php is only one way to check varnish ....
in fact if you type https://domain.tld/files.php? it will request new result
-
the random PHP does not work. It returns a new number every time, that means varnish is not working.
This is rand.php
<?php
echo rand(1, 99);
?>
And the results are "random" , if the cache was working, they results would not change.
-
Are you checking HTTP reply headers?
What is the purpose of the X-Varnish HTTP header?
The X-Varnish HTTP header allows you to find the correct log-entries for the transaction. For a cache hit, X-Varnish will contain both the ID of the current request and the ID of the request that populated the cache. It makes debugging Varnish a lot easier.