Skip to content

Commit

Permalink
Merge pull request ecamp#5910 from BacLuc/varnish-dont-forward-header
Browse files Browse the repository at this point in the history
http-cache: allow to disable sending X-Key headers downstream
  • Loading branch information
usu authored Sep 27, 2024
2 parents 531f1ca + 16882cd commit e0534da
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/reusable-dev-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
--set ingress.basicAuth.username=${{ secrets.BASIC_AUTH_USERNAME }} \
--set ingress.basicAuth.password='${{ secrets.BASIC_AUTH_PASSWORD }}' \
--set apiCache.enabled=${{ vars.API_CACHE_ENABLED || false }} \
--set apiCache.sendXKeyHeadersDownstream=${{ vars.SEND_XKEY_HEADERS_DOWNSTREAM != null && format('''{0}''', vars.SEND_XKEY_HEADERS_DOWNSTREAM) || null }} \
--set mail.dummyEnabled=true \
--set postgresql.url='${{ secrets.POSTGRES_URL }}/ecamp3${{ inputs.name }}?sslmode=require' \
--set postgresql.adminUrl='${{ secrets.POSTGRES_ADMIN_URL }}/ecamp3${{ inputs.name }}?sslmode=require' \
Expand Down
2 changes: 2 additions & 0 deletions .helm/ecamp3/templates/api_cache_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ spec:
value: "{{ .Values.apiCache.varnishHttpPort }}"
- name: COOKIE_PREFIX
value: {{ include "api.cookiePrefix" . | quote }}
- name: SEND_XKEY_HEADERS_DOWNSTREAM
value: {{ .Values.apiCache.sendXKeyHeadersDownstream | quote }}
args:
- -a
- {{ printf ":%d,HTTP" (.Values.apiCache.varnishPurgePort | int) }}
Expand Down
1 change: 1 addition & 0 deletions .helm/ecamp3/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ apiCache:
varnishSize: 50M
varnishHttpPort: 8080
varnishPurgePort: 8081
sendXKeyHeadersDownstream: false
resources:
requests:
cpu: 10m
Expand Down
4 changes: 2 additions & 2 deletions api/docker/varnish/vcl/fos_tags_xkey.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ sub fos_tags_xkey_recv {
}

sub fos_tags_xkey_deliver {
if (!resp.http.X-Cache-Debug) {
// Remove tag headers when delivering to non debug client
if (std.getenv("SEND_XKEY_HEADERS_DOWNSTREAM") != "true" || !resp.http.X-Cache-Debug) {
// Remove tag headers
unset resp.http.xkey;
}
}
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ services:
command: -a :8081,HTTP -p http_max_hdr=96
environment:
- COOKIE_PREFIX=localhost_
- SEND_XKEY_HEADERS_DOWNSTREAM=${SEND_XKEY_HEADERS_DOWNSTREAM:-true}
- VARNISH_HTTP_PORT=8080

pdf:
Expand Down

0 comments on commit e0534da

Please sign in to comment.