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
Not able to work varnish-4.0 template with Drupal #29
Comments
Hi! The first thing you're going to have to change is Drupal's "cache anonymous pages" setting, because all your replies are still setting this header:
The "no-cache" is something Varnish listens to, so it won't cache the page. That needs to be a public cache header. |
@mattiasgeniar Thank you for the reply. I have checked the box "cache anonymous pages". Now my headers changed to the following
Details.
Still did not get varnish though. |
There's still something wrong with your headers in response:
Have you set a TTL for those cacheable pages? |
Yes i set Expiration of cached pages to 6 hrs. My varnish and apache servers are on seperate VMs. |
Let me check that i am not having issues with other modules. I have found this post http://www.mediacurrent.com/blog/why-isnt-my-page-caching and will get back to you accordingly. |
I have looked at the link and it seem like things are ok. Drupal cache headers issue. I am having issues with headers Warm regards, |
Hi, Without access to your drupal and/or server, there isn't much I can do. It's a drupal issue here where it's sending the wrong headers, has nothing to do with this VCL. Maybe your hosting provider can help? Mattias |
Thank you @mattiasgeniar for replying. There are some Drupal modules that are setting the headers to I am in a process of figuring out which Drupal modules are causing it. I have to explicitly search the string Warm regards, |
Hi @manarth Ok I was able to fix apache server to send the following headers from Drupal From Mac Terminal
As you can see Cache-Control: public, max-age=21600 is sending properly. But when I use varnish I am getting the following headers. I am using this varnish vcl https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl.
Please let me know what I need to change in my vcl file. I cannot see any varnish headers. Warm regards, |
How certain are you that Varnish is pointing to the same webserver? Your original request, the one going directly to Apache, does not have the This could mean it isn't the same webserver that's responding? |
Is it also possible to add a setting to this file for XenForo forum (domain.com/forum)? Thanks. |
X-Mod-PageSpeed means that your server is using Google PageSpeed Module. GPS Module sets the header to not cache HTML files. You have two choices:
|
Or email me and I can send you Part 2 Mattias close the issue and thank you for your vlc. |
Hi @mattiasgeniar,
I have tried to use default.vlc template in varnish-4.0-configuration-templates. It seem like it is not working. Is their any configuration I need to do in the template in order to make it work. Please let me know?
My drupal 7 setting are
$conf['cache_backends'][] = 'sites/all/modules/varnish/varnish.cache.inc'; $conf['cache_class_external_varnish_page'] = 'VarnishCache'; $conf['reverse_proxy'] = true; $conf['reverse_proxy_addresses'] = array('172.31.10.68'); $conf['reverse_proxy_header'] = 'HTTP_X_FORWARDED_FOR'; $conf['cache_lifetime'] = 0; $conf['page_cache_maximum_age'] = 21600; $conf['page_cache_invoke_hooks'] = false;
The reply I got from curl -I http://stage.mysite.com/ is
HTTP/1.1 200 OK Date: Fri, 08 Jul 2016 05:27:39 GMT X-Content-Type-Options: nosniff Cache-Control: max-age=0, no-cache, must-revalidate, post-check=0, pre-check=0 X-Content-Type-Options: nosniff Content-Language: en X-UA-Compatible: IE=edge Vary: Accept-Encoding X-Mod-Pagespeed: 1.9.32.14-0 Content-Type: text/html; charset=utf-8 Age: 0 X-Cache: MISS X-Cache-Hits: 0 Connection: keep-alive
When I used configuration from NITEMAN. It works but issue is that its not setting max-age properly
HTTP/1.1 200 OK Date: Fri, 08 Jul 2016 05:06:32 GMT Server: Apache X-Content-Type-Options: nosniff Cache-Control: max-age=0, no-cache, must-revalidate, post-check=0, pre-check=0 X-Content-Type-Options: nosniff Content-Language: en X-UA-Compatible: IE=edge X-Generator: Drupal 7 (http://drupal.org) Link: <http://stage.mysite.com/>; rel="canonical",<http://stage.mysite.com/>; rel="shortlink" Vary: Accept-Encoding X-Mod-Pagespeed: 1.9.32.14-0 Content-Type: text/html; charset=utf-8 X-Varnish-Cacheable: NO:Not Cacheable X-Varnish: 163872 Age: 0 Via: 1.1 varnish-v4 X-Varnish-Cache: MISS X-Varnish-Server: varnish Connection: keep-alive
Please help me I am new to this.
Kind regards,
Javed Gardezi
The text was updated successfully, but these errors were encountered: