-
Notifications
You must be signed in to change notification settings - Fork 82
Reverse proxy in DDEV cluster #2999
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
base: 5.0
Are you sure you want to change the base?
Conversation
Preview of modified filesPreview of modified Markdown: |
|
|
||
| The following sequence of commands: | ||
|
|
||
| 1. Set some variables to distinguish Varnish versions, here for Varnish 7.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 1. Set some variables to distinguish Varnish versions, here for Varnish 7.1 | |
| 1. Set some variables to distinguish between Varnish versions, here for Varnish 7.1 |
| 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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" | |
| VARNISH_VERSION=7.1 | |
| mkdir -p .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 | |
| vcl_path=vcl_path | |
| vcl_file=varnish7.vcl | |
| fi | |
| cp vendor/ibexa/http-cache/docs/varnish/vcl/$vcl_file .ddev/varnish/ | |
| 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" |
And update step descriptions accordingly
| To use Varnish 6.0LTS, set the following variables instead: | ||
|
|
||
| ```bash | ||
| VARNISH_VERSION=6.0 | ||
| vcl_path=vcl_dir | ||
| vcl_file=varnish6.vcl | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When minor variables are moved to the if, then:
| To use Varnish 6.0LTS, set the following variables instead: | |
| ```bash | |
| VARNISH_VERSION=6.0 | |
| vcl_path=vcl_dir | |
| vcl_file=varnish6.vcl | |
| ``` | |
| To use Varnish 6.0LTS, set the following variable instead: | |
| ```bash | |
| VARNISH_VERSION=6.0 | |
| ``` |
| 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' |
There was a problem hiding this comment.
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:) URL probably fails?
But somehow, it shouldn't fail…
|
@adriendupuis : I tested by runing the following script on an existing project: After this, responses still were showing Could you check/confirm ? and: ^ works for me |
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