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
@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

@adriendupuis adriendupuis requested a review from mnocon January 21, 2026 09:12
Copy link
Contributor

@mnocon mnocon left a comment

Choose a reason for hiding this comment

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

Thank you for preparing this!

My main suggestion is to add more links to HTTP cache docs, to connect these two areas of the doc together.

Maybe add a section in HTTP cache docs as well, something along the lines of "See "Varnish with ddev" to learn how to set it up locally with DDEV" (not the exact wording)

content-length: 45678
```

You can see how the `web` server is responding to `varnish`:
Copy link
Contributor

Choose a reason for hiding this comment

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

This line needs a link to HTTP cache doc, that's pretty advanced

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I linked to other examples below (added in e3bfc13)

ddev varnishlog -q "'ReqMethod ~ PURGE.*'";
```

For more information on topics such as available configurations, command lines, or monitoring, see [ddev/ddev-varnish README](https://github.com/ddev/ddev-varnish).
Copy link
Contributor

Choose a reason for hiding this comment

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

Link again to http cache for more info how to use that with Ibexa? That's up to you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see what to link to in the actual state of our doc.
Kept for later.

Co-authored-by: Marek Nocoń <mnocon@users.noreply.github.com>
@adriendupuis adriendupuis requested a review from mnocon January 21, 2026 14:57
Copy link
Contributor

@mnocon mnocon left a comment

Choose a reason for hiding this comment

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

Thank you! Just two small suggestions which I think sound better

Co-authored-by: Marek Nocoń <mnocon@users.noreply.github.com>
@adriendupuis adriendupuis merged commit e79e73f into 5.0 Jan 22, 2026
7 checks passed
@adriendupuis adriendupuis deleted the ddev-varnish branch January 22, 2026 09:32
adriendupuis added a commit that referenced this pull request Jan 22, 2026
* clustering_with_ddev.md: Install reverse proxy
* clustering_with_ddev.md: web's proxy config
* clustering_with_ddev.md: invalidators; ddev varnishlog
* clustering_with_ddev.md: TRUSTED_PROXIES
* clustering_with_ddev.md: Fastly

---------

Co-authored-by: Marek Nocoń <mnocon@users.noreply.github.com>
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.

3 participants