Hot answers tagged

7

You have two options: Solution 1: Disallow caching in the browser In order to prevent a browser from storing and reusing a page, you have to make sure that Cache-Control:no-cache, must-revalidate, post-check=0, pre-check=0 is on the respective (HTML) pages. You can force this header in sub vcl_deliver. Just make sure that you do not put that header on ...


7

With Acquia Cloud API v1 Drush commands On Acquia Could API v1 the command is ac-domain-purge. Here is a snippet from the drush help available from the Acquia box. $ drush help ac-domain-purge Purge a domain from the Varnish cache. Arguments: domain Domain name. Options: --username Acquia Cloud API username ...


7

Pay attention to the Cache-Control header returned from Drupal: Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0 If Cache-Control is set to no-cache, Varnish will respect it by default. Either you must force caching from within Varnish in vcl_fetch or (much better), make Drupal deliver the proper header (Cache-Control: public, max-age=X)....


6

Drush by default is using wget to download project (if available), otherwise curl. This can be change by --package-handler. You can check which package handler is in place by running your command with debug parameter (-d). So you configure proxy the same way as you would configure this for wget or curl. For wget, you can configure these lines in ~/.wgetrc:...


5

You don't have to indicate $base_url = 'https://staging.example.com'; , you can have something like this: server { listen 80; server_name staging.example.com; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name staging.example.com; ...


5

The settings in settings.php will override any configurations you (try) to choose in the Drupal UI: /admin/config/development/performance . $conf['cache_lifetime'] = 0; $conf['page_cache_maximum_age'] = 21600; These two settings would override whatever cache timings you set in the Drupal UI. The maximum_age setting (for example 6 hours) will display in ...


4

As answered by @dicix, Drupal will not return the correct Cache-Control headers to Varnish without "Page Cache" being enabled in the Drupal Performance configuration. The problem I ran into with having both the Drupal Page Cache and Varnish at the same time is that it potentially increases the delay before stale content is refreshed to a maximum of both ...


4

See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3. If a response includes both an Expires header and a max-age directive, the max-age directive overrides the Expires header, even if the Expires header is more restrictive. This rule allows an origin server to provide, for a given response, a longer expiration time to an HTTP/1....


4

You can alter the fast404 code inside of setting.php to handle this. It will handle *.asp & *.pl; changing the regex so it handles paths like /postnuke/article.php /wp-content/ /mailman/ /phpBB/page_header.php Can be done by replacing this $conf['404_fast_paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i'; ...


4

This should work for both Drupal 7 and 8. It's actually the global.inc for one of my Aegir set-ups, which gets injected into all hosted sites' settings.php files. <?php # global settings.php /** * Tell all Drupal sites that we're running behind an HTTPS proxy. */ // Drupal 7 configuration. if (explode('.', VERSION)[0] == 7) { $conf['reverse_proxy']...


4

Here is the code that flush cache on first hit of a day: public function build() { ... ... ... $this->handleCacheTag($build['#cache']['tags']); } protected function handleCacheTag(&$tags) { // Get the current date number. $current_date_number = date('z'); $last_date_number = \Drupal::state()->get('module_name.foo....


3

When an generated image is not available, the page callback is image_style_deliver(). This callback first generate the image (after some access and concurrency checks) and then stream the file as response (through the file_transfer() function). Using hook_menu_alter(), you can override the image generation callback to redirect to the static domain once the ...


3

I got it a little bit later. It was just the array format being different in the two sources I copies and pasted from. The problem line was: #$conf['cache_backends'][] = array('sites/all/modules/contrib/varnish/varnish.cache.inc'); It should be: #$conf['cache_backends'][] = 'sites/all/modules/contrib/varnish/varnish.cache.inc';


3

Below is the text that can been seen when using Google Chrome and under Network inspecting the response for you webpage. Observe the very last line. There you should get two numbers X-Varnish:1125490268 1125489929. I've had problems before setting up Varnish and everything seemed to be going fine, then I noticed that only one number was present in X-Varnish....


3

Install the varnish module and set the minimum cache lifetime to none at admin/config/development/performance Also be sure to add the tweaks to the settings.php from the varnish module page. This should ensure that the cache is flushed when new content is added. You may want things to be a little more granular (if a complete cache clear at every content ...


3

Good point Jimajamma, but my question was different. Apparently I got the answer for this, if case someone else is interested. Varnish will not cache pages unless both "Page Cache" is turned on and a "Page cache max-age" is set. Drupal will not set the correct caching headers if "Page Cache" is not enabled. "Cache lifetime" and "Block Cache" does not ...


3

You may install Varnish HTTP Accelerator Integration module and set the following lines in your settings file: /** * Varnishd Configuration * * This cache implementation can be used together with Varnish. You can't really use it to store or get any values, but you can use it to purge your caches. * This cache implementation should ONLY be used for ...


3

Varnish and Pressflow are two different things.. Pressflow uses varnish to improve performance.. More details goes below.. Pressflow is “a derivative of Drupal core providing enhanced performance, scalability, and data integrity”. Basically, some really smart guys at Four Kitchens and elsewhere back-ported a bunch of Drupal 7 performance enhancements to the ...


3

The offending parts in your VCL are (line 53): # Drop any cookies sent to Drupal. if (!(req.url ~ "install\.php|update\.php|cron\.php|admin\.php")) { unset req.http.cookie; } and (line 81): # Drop any cookies Drupal tries to send back to the client. This will make it unpossible to login, unless you filter it a bit better that it is made below sub ...


3

You can use Rename Admin Paths module to override the admin path. This module allows you to: rename path like '/admin/...' to '/something/...' rename path like '/user/..' to '/something else/..' It can be effective against registration spam bots or malicious people. And using the Login Security module you can limit the number of invalid ...


3

max-age 60s is pretty low for the frontpage. Does the data really update that frequently or is it just that it could update but usually it doesn't happen every minute? One possible approach to solve this would be to fetch that external data on a cron job that runs every minute. If and only if you detect a change, you invalidate a cache tag, which ...


3

The problem has to do with how cookies are associated with domains. After you log into a Drupal site, Drupal sends a cookie to the browser that it uses in future requests to show it has been authenticated. Drupal associates that cookie with the domain that the login occurred on. Since your proxy sends requests to your Drupal site using the hiddendomain.be ...


2

You could try the cache warmer module, which apparently does just that. There are also a bunch of blog posts on the topic around the web.


2

For running Drupal 8 websites using Varnish Cache, install the Purge module. Purge will manage the Varnish Cache from Drupal 8 admin unless you need to support Cache Tags. To Support Cache Tags with Varnish, install the Varnish Purger module. Visit this GitLab page for an example of the Varnish VCL code required to support the Purge and Varnish Purge ...


2

$conf['reverse_proxy_addresses'] had my old load balancer IP, thanks to AWS changing the IP without telling me. Once I updated with the current LB address, it worked as expected.


2

There is also a module for that called appropriately "Acquia Purge". Works perfectly. Details from project page: The Acquia Purge module allows Drupal sites hosted on Acquia Cloud to automatically purge (wipe) pages from their Varnish powered load balancers, as soon as content actually changed. The higher Drupal's "expiration of cached pages"-setting (TTL)...


2

A response of sorts: 1.~images are served from a different virtual host (e.g. image.example.com) You can use NFS to mount Drupal's sites/default/files directory to an images.example.com document root, or perhaps an equivalent network directory mount method for your OS. 2.~thumbnailed images are never written to disk I don't know if that is possible ...


2

Unless you have a strong suspicion on a particular module or a small number of modules that could be creating a session, finding the 'culprit' module could be too tiresome. I would suggest searching for the 'cookie name' instead of a string like '_SESSION' as a more accurate and a faster way. Say if the cookie name is 'PLAY_ACTIVE_ACCOUNT' (real example ...


2

If you are using the Varnish HTTP Accelerator Integration module, you can use the varnish_expire_cache() function, that accepts specifics paths like nodes or could be for other paths too.


2

In your settings.php are you using $conf['omit_vary_cookie'] = TRUE; ? If so, logged in users who have previous viewed a page when logged out will be served the varnish cached version of their page until they manually refresh their browser. The solution is to simply comment out $conf['omit_vary_cookie'] = TRUE; in your settings.php. This is explained in ...


Only top voted, non community-wiki answers of a minimum length are eligible