GithubHelp home page GithubHelp logo

wodby / varnish Goto Github PK

View Code? Open in Web Editor NEW
59.0 6.0 29.0 897 KB

Varnish docker container image

Home Page: https://wodby.com/stacks/varnish

License: MIT License

Makefile 13.81% Shell 54.10% Dockerfile 32.09%
varnish docker alpine

varnish's Introduction

Varnish Docker Container Image

Build Status Docker Pulls Docker Stars

Docker Images

❗For better reliability we release images with stability tags (wodby/varnish:6-X.X.X) which correspond to git tags. We strongly recommend using images only with stability tags.

Overview:

All images built for linux/amd64 and linux/arm64

Supported tags and respective Dockerfile links:

Environment Variables

Variable Default Value Description
VARNISH_ALLOW_UNRESTRICTED_PURGE Used for ban requests as well
VARNISH_BACKEND_BETWEEN_BYTES_TIMEOUT 60s
VARNISH_BACKEND_CONNECT_TIMEOUT 3.5s
VARNISH_BACKEND_FIRST_BYTE_TIMEOUT 60s
VARNISH_BACKEND_GRACE 2m
VARNISH_BACKEND_HOST Mandatory
VARNISH_BACKEND_PORT 80
VARNISH_CACHE_PER_COUNTRY Separate caches based on country code
VARNISH_CACHE_PER_CURRENCY Separate caches based on currency
VARNISH_CURRENCY_EUR_COUNTRY_CODES See currencies
VARNISH_CURRENCY_USD_COUNTRY_CODES See currencies
VARNISH_BIG_FILES_SIZE 10485760 10MB
VARNISH_BIG_FILES_TTL 120s
VARNISH_CACHE_STATIC_FILES
VARNISH_CONFIG_PRESET
VARNISH_DEFAULT_TTL 120s
VARNISH_ERRORS_GRACE 15s
VARNISH_PURGE_EXTERNAL_REQUEST_HEADER
VARNISH_KEEP_ALL_COOKIES
VARNISH_KEEP_ALL_PARAMS
VARNISH_IMPORT_MODULES Separated by comma
VARNISH_MOBILE_DISABLE_CASH
VARNISH_MOBILE_SEPARATE_CASH
VARNISH_MOBILE_USER_AGENT See default value below
VARNISH_PIPE_CLOSE_CONNECTION
VARNISH_PURGE_KEY Randomly generated if missing
VARNISH_SECONDARY_STORAGE_CONDITION Must be valid VCL
VARNISH_SECRET Generated automatically if missing
VARNISH_STATIC_FILES See default value below
VARNISH_STATIC_TTL 86400 In seconds
VARNISH_STRIP_COOKIES See default value below
VARNISH_STRIP_PARAMS See default value below
VARNISH_STRIP_ALL_PARAMS Ignored if $VARNISH_KEEP_ALL_PARAMS is set
VARNISH_PAGESPEED_SECRET_KEY Should be used if mod_pagespeed is enabled
VARNISHD_DEFAULT_TTL 120
VARNISHD_MEMORY_SIZE 64m
VARNISHD_PARAM_BAN_LURKER_AGE 60.000
VARNISHD_PARAM_BAN_LURKER_BATCH 1000
VARNISHD_PARAM_BAN_LURKER_SLEEP 0.010
VARNISHD_PARAM_BETWEEN_BYTES_TIMEOUT 60.000
VARNISHD_PARAM_CONNECT_TIMEOUT 3.500
VARNISHD_PARAM_DEFAULT_GRACE 10.000
VARNISHD_PARAM_DEFAULT_KEEP 0.000
VARNISHD_PARAM_DEFAULT_TTL 120.000
VARNISHD_PARAM_FETCH_CHUNKSIZE 16k
VARNISHD_PARAM_FIRST_BYTE_TIMEOUT 60.000
VARNISHD_PARAM_GZIP_BUFFER 32k
VARNISHD_PARAM_GZIP_LEVEL 6
VARNISHD_PARAM_GZIP_MEMLEVEL 8
VARNISHD_PARAM_HTTP_GZIP_SUPPORT on
VARNISHD_PARAM_HTTP_MAX_HDR 64
VARNISHD_PARAM_HTTP_REQ_HDR_LEN 8k
VARNISHD_PARAM_HTTP_REQ_SIZE 32k
VARNISHD_PARAM_HTTP_RESP_HDR_LEN 8k
VARNISHD_PARAM_HTTP_RESP_SIZE 32k
VARNISHD_PARAM_IDLE_SEND_TIMEOUT 60.000
VARNISHD_PARAM_MAX_ESI_DEPTH 5
VARNISHD_PARAM_MAX_RESTARTS 4
VARNISHD_PARAM_MAX_RETRIES 4
VARNISHD_PARAM_NUKE_LIMIT 50
VARNISHD_PARAM_PING_INTERVAL 3
VARNISHD_PARAM_PIPE_TIMEOUT 60.000
VARNISHD_PARAM_POOL_REQ 10,100,10
VARNISHD_PARAM_POOL_SESS 10,100,10
VARNISHD_PARAM_PREFER_IPV6 off
VARNISHD_PARAM_RUSH_EXPONENT 3
VARNISHD_PARAM_SEND_TIMEOUT 600
VARNISHD_PARAM_SHORTLIVED 10.000
VARNISHD_PARAM_TCP_KEEPALIVE_INTVL 75.000
VARNISHD_PARAM_TCP_KEEPALIVE_PROBES 8
VARNISHD_PARAM_TCP_KEEPALIVE_TIME 7200.000
VARNISHD_PARAM_THREAD_POOL_ADD_DELAY 0.000
VARNISHD_PARAM_THREAD_POOL_DESTROY_DELAY 1.000
VARNISHD_PARAM_THREAD_POOL_FAIL_DELAY 0.200
VARNISHD_PARAM_THREAD_POOL_MAX 5000
VARNISHD_PARAM_THREAD_POOL_MIN 100
VARNISHD_PARAM_THREAD_POOL_STACK 48k
VARNISHD_PARAM_THREAD_POOL_TIMEOUT 300.000
VARNISHD_PARAM_THREAD_POOLS 2
VARNISHD_PARAM_THREAD_QUEUE_LIMIT 20
VARNISHD_PARAM_TIMEOUT_IDLE 5.000
VARNISHD_PARAM_TIMEOUT_LINGER 0.050
VARNISHD_PARAM_VSL_BUFFER 4k
VARNISHD_PARAM_VSL_RECLEN 255b
VARNISHD_PARAM_VSL_SPACE 80M
VARNISHD_PARAM_VSM_SPACE 1M
VARNISHD_PARAM_WORKSPACE_BACKEND 64k
VARNISHD_PARAM_WORKSPACE_CLIENT 64k
VARNISHD_PARAM_WORKSPACE_SESSION 0.50k
VARNISHD_PARAM_WORKSPACE_THREAD 2k
VARNISHD_SECONDARY_STORAGE See example below
VARNISHD_SECRET_FILE /etc/varnish/secret
VARNISHD_VCL_SCRIPT /etc/varnish/default.vcl
VARNISH_MOBILE_USER_AGENT:

Backslashes must be escaped as \\

ipod|android|blackberry|phone|mobile|kindle|silk|fennec|tablet|webos|palm|windows ce|nokia|philips|samsung|sanyo|sony|panasonic|ericsson|alcatel|series60|series40|opera mini|opera mobi|au-mic|audiovox|avantgo|blazer|danger|docomo|epoc|ericy|i-mode|ipaq|midp-|mot-|netfront|nitro|pocket|portalmmm|rover|sie-|symbian|cldc-|j2me|up\\.browser|up\\.link|vodafone|wap1\\.|wap2\\.
VARNISH_STATIC_FILES:
asc|doc|xls|ppt|csv|svg|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm|webp
VARNISH_STRIP_COOKIES

Ignored if $VARNISH_KEEP_ALL_COOKIES is set

__[a-z]+|wooTracker|VCKEY-[a-zA-Z0-9-_]+
VARNISH_STRIP_PARAMS

Ignored if $VARNISH_KEEP_ALL_PARAMS is set

utm_[a-z]+|gclid|cx|ie|cof|siteurl|fbclid
VARNISH_SECONDARY_STORAGE_CONDITION:

Allows defining custom conditions for storing the cache object in the secondary storage; as it is injected into an if it has to contain valid VCL syntax for it.

Please note that VARNISHD_SECONDARY_STORAGE must be defined as well, otherwise the secondary storage would not be available.

Example: instruct varnish to store in the secondary storage from the backend via custom header X-Cache-Bin:

VARNISH_STORAGE_CONDITION='beresp.http.x-cache-bin = "secondary"'

Installed Modules

Module Version Imported
geoip 1.0.3 βœ“
digest 1.0.2
cookie latest
vsthrottle latest
header latest
saintmode latest
softpurge latest
tcp latest
var latest
xkey latest
bodyaccess latest

Modules can be imported as $VARNISH_IMPORT_MODULES=xkey,softpurge.

Default Behaviour

Caching Rules

  • Only GET or HEAD requests are cached
  • Backend responses with Set-Cookie header not cached
  • Static files (see $VARNISH_STATIC_FILES) not cached by default, set $VARNISH_CACHE_STATIC_FILES to cache
  • Error pages 404 and >500 not cached with grace period $VARNISH_ERRORS_GRACE
  • All AJAX requests not cached
  • Big files (larger than $VARNISH_BIG_FILES_SIZE) not cached

Cache Personification

White-listed cookies starting with VCKEY- followed by alphanumeric characters, underscores or hyphens are used to build cache hash. You can use such cookies to personify cache by a certain criteria, e.g. set VCKEY-lang to en or fr to cache different versions for English and French users.

On your backend you should check whether VCKEY- cookie exists, if it does generate a personified version of a page and do not set cookie again, otherwise it won't be cached on Varnish.

GeoIP

We identify client's two-letter country code (ISO 3166) and pass it to a backend in X-Country-Code header. If Varnish could not recognize the country the default value will be Unknown. You can optionally uniquify cache per country by setting $VARNISH_CACHE_PER_COUNTRY=1. We use GeoLite database from MaxMind.

If we see CloudFlare country code header we use it instead.

Currency

We use the country code to identify the currency and pass it to a backend in X-Currency header. You can optionally uniquify cache per currency by setting $VARNISH_CACHE_PER_CURRENCY=1.

We use data from IBAN to identify which country uses which currency, currently only USD and EUR supported.

Country codes for USD ($VARNISH_CURRENCY_USD_COUNTRY_CODES):

US|AS|BQ|IO|EC|SV|GU|HT|MH|FM|MP|PA|PW|PR|TL|TC|UM|VG|VI

Country codes for EUR ($VARNISH_CURRENCY_EUR_COUNTRY_CODES):

AD|AT|BE|CY|EE|FI|FR|GF|TF|DE|GP|GR|VA|IE|IT|LV|LT|LU|MT|MQ|YT|MC|ME|NL|PT|RE|BL|MF|PM|SM|SK|SI|ES|CE|CH|AX

Cache Flushing

  • Purge and ban requests both use Varnish's ban method to flush cache and restricted by the purge key $VARNISH_PURGE_KEY (generated if missing). Use header X-VC-Purge-Key to pass the key for purge/ban requests
  • Purge requests look up for exact match but ignores query params, you can change the method by setting X-VC-Purge-Method to regex or exact (respects query params)
  • Additionally for ban requests cache flushed by Cache-Tags header (Drupal's case)
  • If you want to allow unrestricted purge/ban requests in internal network specify a header via $VARNISH_PURGE_EXTERNAL_REQUEST_HEADER that exists only for external requests (e.g. X-Real-IP). If specified header is not set Varnish will skip purge key check

Miscellaneous

  • Header X-VC-Cache set to HIT or MISS when varnish delivers content
  • Cache hash includes host (or ip) and request protocol
  • Varnish adds client's IP added to X-Forwarded-For
  • Websocket requests supported
  • Query params ($VARNISH_STRIP_PARAMS) stripped unless $VARNISH_KEEP_ALL_PARAMS is set
  • Cookies ($VARNISH_STRIP_COOKIES) stripped unless $VARNISH_KEEP_ALL_COOKIES is set
  • Hashes and trailing ? stripped from URL before passing to backend
  • By default cache mobile devices is identical. You can separate it by setting $VARNISH_MOBILE_SEPARATE_CASH or completely disable by setting $VARNISH_MOBILE_DISABLE_CASH. Regex $VARNISH_MOBILE_USER_AGENT used to identify mobile devices by User-Agent header
  • Set one of the following headers from backend to disable caching for a page:
    X-VC-Cacheable: NO
    Cache-control: private
    Cache-control: no-cache
    
  • Set X-VC-Debug to show cache hashes and pass through header X-VC-DebugMessage
  • BigPipe supported
  • Secondary storage can be defined via $VARNISH_STORAGE_CONDITION
  • ./vchealthz is a liveness endpoint with 204 response code

Config Presets

You can use one of the following config presets to extend the default behaviour:

Drupal

Add VARNISH_CONFIG_PRESET=drupal to use this preset.

  • Pages matching $VARNISH_DRUPAL_EXCLUDE_URLS will not be cached
  • If a cookie from $VARNISH_DRUPAL_PRESERVED_COOKIES is set a page will not be cached. All other cookies stripped
VARNISH_DRUPAL_EXCLUDE_URLS:

Backslashes must be escaped as \\

^(/update\\.php|/([a-z]{2}/)?admin|/([a-z]{2}/)?admin/.*|/([a-z]{2}/)?system/files/.*|/([a-z]{2}/)?flag/.*|.*/ajax/.*|.*/ahah/.*)$
VARNISH_DRUPAL_PRESERVED_COOKIES:

Not affected by $VARNISH_KEEP_ALL_COOKIES

SESS[a-z0-9]+|SSESS[a-z0-9]+|NO_CACHE

WordPress

Add VARNISH_CONFIG_PRESET=wordpress to use this preset.

  • Requests with ak_action|app-download query params or akm_mobile cookie not cached (Jetpack plugin)
  • Strips replytocom= query param
  • Use $VARNISH_WP_ADMIN_SUBDOMAIN if you have your admin on a subdomain to disable caching
  • If a cookie from $VARNISH_WP_PRESERVED_COOKIES is set a page will not be cached. All other cookies stripped
VARNISH_WP_PRESERVED_COOKIES:

Not affected by $VARNISH_KEEP_ALL_COOKIES

PHPSESSID|wp-postpass_[a-z0-9]+|wordpress_[_a-z0-9]+|wordpress_logged_in_[a-z0-9]+|woocommerce_cart_hash|woocommerce_items_in_cart|wp_woocommerce_session_[a-z0-9]+|akm_mobile

PageSpeed Downstream Caching

This image contains implementation for modpagespeed downstream caching as described at https://www.modpagespeed.com/doc/downstream-caching. You can enable this behavior by specifying $VARNISH_PAGESPEED_SECRET_KEY to the value that matches DownstreamCacheRebeaconingKey in your Nginx/Apache config. This value will be used as PS-ShouldBeacon for 5% of hits and 25% of misses. Also, when static files cache enabled on Varnish, PS-CapabilityList will be set to fully general optimizations only to unify behavior for all browsers.

Orchestration Actions

make COMMAND [params ...]

commands:
    check-ready [host max_try wait_seconds delay_seconds]
    flush [host]
 
default params values:
    host localhost
    max_try 1
    wait_seconds 1
    delay_seconds 0

Deployment

Deploy Varnish container to your own server via Wodby Wodby.

varnish's People

Contributors

csandanov avatar efpapado avatar jlalvarez18 avatar llaumgui avatar pprishchepa avatar sirdiego avatar wodbot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

varnish's Issues

varnish cache tag invalidation not working with drupal 8.

Using the Varnish Purge module with the following headers set:

Cache-Tags: [invalidation:expression]
X-VC-Purge-Key:

never seems to invalidate.

I believe this is due to the wodby image vcl looking for the Cache-Tags header when drupal is returning X-Drupal-Cache-Tags.
The attached patch seems to fix the issue.

diff --git a/templates/includes/purge.vcl.tmpl b/templates/includes/purge.vcl.tmpl
index e30e2b1..aef0de8 100755
--- a/templates/includes/purge.vcl.tmpl
+++ b/templates/includes/purge.vcl.tmpl
@@ -48,8 +48,8 @@ sub vcl_recv {
         {{ end }}
         {{ end }}
 
-        if (req.method == "BAN" && req.http.Cache-Tags) {
-            ban("obj.http.Cache-Tags ~ " + req.http.Cache-Tags);
+        if (req.method == "BAN" && req.http.X-Drupal-Cache-Tags) {
+            ban("obj.http.X-Drupal-Cache-Tags ~ " + req.http.X-Drupal-Cache-Tags);
         }
 
         if (req.http.X-VC-Purge-Method) {

Drupal Preset SESS[a-z0-9]+|SSESS[a-z0-9]+|NO_CACHE not appended

If VARNISH_DRUPAL_PRESERVED_COOKIES is set, required Session and No_Cache cookies are also gets stripped contrary to documentation. Also, it's not clear how to handle multiple cookies with VARNISH_DRUPAL_PRESERVED_COOKIES on composer.yml

dockercompose:
VARNISH_DRUPAL_PRESERVED_COOKIES: "example"
actual varnish container "preset.vcl":
`/ # cat /etc/varnish/preset.vcl
sub vcl_recv {

# Pass through any administrative or AJAX-related paths.
if (req.url ~ "^(/update\.php|/([a-z]{2}/)?admin|/([a-z]{2}/)?admin/.*|/([a-z]{2}/)?system/files/.*|/([a-z]{2}/)?flag/.*|.*/ajax/.*|.*/ahah/.*)$") {
    return (pass);
}

if (req.url ~ "(^/([a-z]{2}/)?batch)") {
    return (pipe);
}

# Remove all cookies that Drupal doesn't need to know about. We explicitly
# list the ones that Drupal does need, the SESS and NO_CACHE. If, after
# running this code we find that either of these two cookies remains, we
# will pass as the page cannot be cached.
if (req.http.Cookie) {


    # 1. Append a semi-colon to the front of the cookie string.
    # 2. Remove all spaces that appear after semi-colons.
    # 3. Match the cookies we want to keep, adding the space we removed
    #    previously back. (\1) is first matching group in the regsuball.
    # 4. Remove all other cookies, identifying them by the fact that they have
    #    no space after the preceding semi-colon.
    # 5. Remove all spaces and semi-colons from the beginning and end of the
    #    cookie string.
    set req.http.Cookie = ";" + req.http.Cookie;
    set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
    set req.http.Cookie = regsuball(req.http.Cookie, ";(example)=", "; \1=");
    set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
    set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");

    if (req.http.Cookie == "") {
        # If there are no remaining cookies, remove the cookie header. If there
        # aren't any cookie headers, Varnish's default behavior will be to cache
        # the page.
        unset req.http.Cookie;
    }
    else {
        # If there is any cookies left (a session or NO_CACHE cookie), do not
        # cache the page. Pass it on to Apache directly.
        return (pass);
    }
}

}`

Support of WooCommerce cart cookies

WooCommerce may use 3 cookies for anonymous users:

  • woocommerce_cart_hash
  • woocommerce_items_in_cart
  • wp_woocommerce_session_

We need a way to avoid caching for such cookies and probably for some paths:

  • /cart
  • /my-account
  • /checkout
  • /addons
  • ?add-to-cart=
  • /add-to-cart

Actually, I'm not sure about paths because cookies exclusion should be enough but I see a few examples of WooCommerce integration with both cookies and paths exclusion. It seems it should be tested additionally.

I suggest to implement a generic way to exclude caching for cookies and paths.

VARNISH_KEEP_ALL_COOKIES does not work

We have a problem with VARNISH_KEEP_ALL_COOKIES and wordpress preset. We set VARNISH_KEEP_ALL_COOKIES to 1 but none of there cookies except ones compliant with VARNISH_WP_PRESERVED_COOKIES are accessible in php.
We also tried a pure php page outside of wordpress code and still getting the save results, no cookies are preserved.

Idea: cache POST request with specific header

It would be awesome to be able to cache some POST requests (ex: product filters etc) and I get why they are bypassed by default. But would you be open to the idea of adding a header that would allow caching of POST?

Best regards

An Instruction

Where I can find any instructions about how to test the container work?
I want to configure it with Drupal 8 and I got the message

Varnish at varnish:6081 not responding.

Varnish caching Drupal private files

I'm having trouble with Drupal private files returning 403s/404s to authenticated users (including admins).

I've added the example regex for system/files in the README in VARNISH_DRUPAL_EXCLUDE_URLS but no luck.

I noticed that cee55bd addressed this but the order was later reversed in e5c91eb. Is there additional config that solves this?

Thanks for these well-documented Docker images!

Varnish is not compiling - container exit code 2

I am facing some real issues while ruining wodby/varnish:4-4.6.4 container - Varnish does not compile.
Here is the error from logs:
wodby/varnish:4-4.6.4
Error: Running VCC-compiler failed, signal 5 VCL compilation failed
The environment for me:
docker run -it --rm -e VARNISH_BACKEND_HOST=localhost -e VARNISH_BACKEND_PORT=8080 -e VARNISH_CONFIG_PRESET=drupal wodby/varnish:4-4.6.4

Arm images missing

We're getting 1st Apple M1 devices and we saw that Varnish image has no arm build.

WordPress caching not working

I have my own deployment using the wodby images. And I have uncommented the Varnish container in my docker-compose.yml and followed the directions found here: https://wodby.com/docs/stacks/wordpress/containers/#varnish

My settings look like this:
varnish

Looking at the logs for the varnish container, it never logs activity and do not see the X-VC-Cache being set to the client. I am currently setting the IP field to the name of the container, is this correct?

Varnish modules not imported [SOLVED]

First, thanks for the useful varnish image!

Just trying to add the bodyaccess module, but it appears the varnish modules can't be added as documented.

The environment variable is set, but the module is not available.

Screen Shot 2019-08-16 at 11 33 26 AM

Screen Shot 2019-08-16 at 11 35 22 AM

Also tried the manual import:

Screen Shot 2019-08-16 at 11 37 50 AM

Using image wodby/varnish:4.1-4.3.2

Problem with purge key

On my site I'm using varnish_tag 6.0-4.0.0 with varnish_purger module on a Drupal installation.
With 4.1-3.0.7 I've no problem, I've update to latest stable release and for every request I've this error in my watchdog entries:

purger_varnish_d671be62a8: item failed due GuzzleHttp\Exception\ClientException, details (JSON): {"msg":"Client error: BAN http://varnish:6081/resulted in a405 Not allowed from 172.27.0.3 response: <!DOCTYPE html> <html> <head> <title>405 Not allowed from 172.27.0.3<\/title> <\/head> <body> <h1>Error 405 (truncated...) ","uri":"http:\/\/varnish:6081\/","method":"BAN","guzzle_opt":{"http_errors":true,"connect_timeout":1,"timeout":1},"headers":{"user-agent":"varnish_purger module for Drupal 8.","cache-tags":"config:system.menu.main","x-vc-my-purge-key":"secret"}}

This is the varnish section of my docker-compose:

varnish:
    image: wodby/varnish:$VARNISH_TAG
    container_name: "${PROJECT_NAME}_varnish"
    depends_on:
      - nginx
    environment:
      VARNISH_SECRET: secret
      VARNISH_PURGE_KEY: secret
      VARNISH_BACKEND_HOST: nginx
      VARNISH_BACKEND_PORT: 80
      VARNISH_CONFIG_PRESET: drupal
      VARNISH_PURGE_EXTERNAL_REQUEST_HEADER: X-Real-IP
      VARNISH_DRUPAL_PRESERVED_COOKIES: "SESS[a-z0-9]+|SSESS[a-z0-9]+|NO_CACHE+|Drupal.visitor.legal_hash+|Drupal.visitor.legal_id"

On the module configuration I've added an header "X-VC-My-Purge-Key" with value "secret".

Is it the right way?

Thanks a lot,
Sergio

Add mod digest

Hi, can you add vmod_digest to this image?

I tried compiling it after but from my understanding that is not possible, because you delete all the relevant header files. See the README.

Otherwise the installation seems to be very similar to vmod_geoip.

Varnish failed to start child

21 Feb 10:27:18am UTC | Error: Child (32) not responding to CLI, killed it.
21 Feb 10:27:18am UTC | Error: Unexpected reply from ping: 400 CLI communication error (hdr)
21 Feb 10:27:35am UTC | Error: Child (32) not responding to CLI, killed it.
21 Feb 10:27:35am UTC | Error: Unexpected reply from ping: 400 CLI communication error
21 Feb 10:27:35am UTC | Error: Child (32) died signal=3
21 Feb 10:27:35am UTC | Error: Unexpected reply from ping: 400 CLI communication error (hdr)
21 Feb 10:27:36am UTC | Debug: Child cleanup complete
21 Feb 10:27:36am UTC | Debug: Child (145) Started
21 Feb 10:28:36am UTC | CLI result = 400
21 Feb 10:28:36am UTC | Error: Child (145) Pushing vcls failed:
21 Feb 10:28:36am UTC | CLI communication error (hdr)
21 Feb 10:28:36am UTC | Debug: Stopping Child
21 Feb 10:28:43am UTC | Info: Child (145) ended
21 Feb 10:28:43am UTC | Info: Child (145) said Child starts
21 Feb 10:28:43am UTC | Info: Child (145) said Child dies
21 Feb 10:28:43am UTC | Debug: Child cleanup complete

K8s doesn't restart Varnish container if health-check fails

Drupal responsive image styles not generated when requested by anonymous users

The url rewrite on line 18 of templates/includes/static.vcl.tmpl causes 404 image responses from Drupal when an anonymous user visits a page with responsive image styles.

This is due to the itok parameter being removed by line 18. The ImageStyleDownloadController processes the request in Drupal and passes back a 404 as there is no valid itok.

Steps to reproduce:

  • Stock Docker4Drupal with Varnish and the VARNISH_CACHE_STATIC_FILES environment variable set.
  • Drupal configured to cache (/admin/config/development/performance).
  • The following modules enabled: responsive_image, media, media_library.
  • Add a media field to a content type.
  • Configure a responsive image style - My configuration is Bartik Breakpoint groups with Select a single image style for each breakpoint.
  • Change default media display to use a responsive image style.
  • Change media field display (if needed) to use display with responsive image style.
  • Add a node with an image and while logged in do not resize browser (this would cause images to generate as varnish will pass back response without altering).
  • Ensure page is cached via headers.
  • View varnish version of page and resize - any styles that were not accessed by authenticated user will return 404.

Commenting out line 18 of the include resolves this issue.

WSOD with hudge headers

Hi,

On our dev environments, we've got the following drupal setting set to true on our development.services.yml :
http.response.debug_cacheability_headers: true

With some huge content types, create/edit forms reponses sends an extremly large X-Drupal-Cache-Tags header, which breaks varnish with the following error :

BogoHeader Header too long: X-Drupal-Cache-Tags

We've found a dirty workaround by setting VARNISHD_THREAD_POOL_MAX to 1000 -p http_resp_hdr_len=65536 -p http_resp_size=98304 since VARNISHD_THREAD_POOL_MAX is the last used variable.

Would it be possible to add VARNISHD_RESP_HDR_LEN and VARNISHD_HTTP_RESP_SIZE to the available variables please ?

Thank you !

Compile varnish from sources

The current 4.x version no longer actively supported and installed from alpine 3.6 repository that reaches EOL in May. We also need to support version 6.x as well.

Drupal preset - cache public static files for authenticated users.

The changes in #24 have disabled caching of all static files for authenticated users.

While it is good that Drupal private files (/system/files/*) should not be cached for authenticated users, there are lots of other static files that should still be safe candidates to cache. e.g. public files, css, js, images included in theme or module folders etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.