Skip to content

Conversation

@adriendupuis
Copy link
Contributor

@adriendupuis adriendupuis commented Jan 8, 2026

Question Answer
JIRA Ticket N/A
Versions 5.0, 4.6
Edition All

How to add a reverse proxy Varnish or Fastly, into a DDEV cluster.

Preview https://ez-systems-developer-documentation--2999.com.readthedocs.build/en/2999/infrastructure_and_maintenance/clustering/clustering_with_ddev/#install-reverse-proxy

Checklist

  • Text renders correctly
  • Text has been checked with vale
  • Description metadata is up to date
  • Redirects cover removed/moved pages
  • Code samples are working
  • PHP code samples have been fixed with PHP CS fixer
  • Added link to this PR in relevant JIRA ticket or code PR

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

Preview of modified files

Preview of modified Markdown:

@adriendupuis adriendupuis requested a review from reithor January 9, 2026 15:25
@adriendupuis adriendupuis marked this pull request as ready for review January 12, 2026 08:21
@adriendupuis adriendupuis requested a review from juskora January 12, 2026 08:52
You can see how the `web` server is responding to `varnish`:

```console
% curl -s -H "Surrogate-Capability: abc=ESI/1.0" http://127.0.0.1:<http-web-port>/product-catalog | grep 'esi:include'
Copy link
Contributor Author

@adriendupuis adriendupuis Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO:
Maybe a warning about the fact that the HTTPS (https://127.0.0.1:<https-web-port>) URL probably fails?
But somehow, it shouldn't fail…

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a warning about the fact that the HTTPS (https://127.0.0.1:<https-web-port>) URL probably fails?
But somehow, it shouldn't fail…

For me https is working fine:

% curl -s -H "Surrogate-Capability: abc=ESI/1.0" https://127.0.0.1:<https-web-port>/product-catalog | grep 'esi:include'

Copy link
Contributor Author

@adriendupuis adriendupuis Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reithor I felt it was coming from my own installation. If i found how to fix it, there still might be something to add somewhere. But, thank you for the good news!

@reithor
Copy link
Contributor

reithor commented Jan 12, 2026

@adriendupuis : I tested by runing the following script on an existing project:

#!/bin/bash

VARNISH_VERSION=7.1
vcl_path=vcl_path
vcl_file=varnish7.vcl

mkdir -p .ddev/varnish
cp vendor/ibexa/http-cache/docs/varnish/vcl/$vcl_file .ddev/varnish/
sed 's/.host = "127.0.0.1";/.host = "web";/' vendor/ibexa/http-cache/docs/varnish/vcl/parameters.vcl > .ddev/varnish/parameters.vcl
sed -i '/^acl invalidators {$/a \\    "web";' .ddev/varnish/parameters.vcl
sed -i '/^acl debuggers {$/a \\    "0.0.0.0"/0; \/\/ debug from any IP' .ddev/varnish/parameters.vcl
if [[ $VARNISH_VERSION == 7.* ]]; then
  sed -i 's/acl invalidators {/acl invalidators +log {/' .ddev/varnish/parameters.vcl
  sed -i 's/acl debuggers {/acl debuggers +log {/' .ddev/varnish/parameters.vcl
fi
ddev dotenv set .ddev/.env.varnish --varnish-docker-image=varnish:$VARNISH_VERSION --varnish-varnishd-params " -p $vcl_path=/etc/varnish -f /etc/varnish/$vcl_file"

ddev get ddev/ddev-varnish

ddev config --web-environment-add HTTPCACHE_PURGE_SERVER=http://varnish
ddev config --web-environment-add HTTPCACHE_PURGE_TYPE=varnish
ddev config --web-environment-add TRUSTED_PROXIES=varnish

ddev restart

After this, responses still were showing x-cache-tags response header (should be Xkey).
I had to empty var/cache directory followed by running ddev restart to make it work.
After this cache purging by xkey was working fine.

Could you check/confirm ?

and:

curl -s -H "Surrogate-Capability: abc=ESI/1.0" https://127.0.0.1:<https-web-port> 

^ works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants