Skip to content

Instantly share code, notes, and snippets.

@frafra
Created November 16, 2023 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frafra/cdfc98cdbbe93bbdb73ed6363c5c613f to your computer and use it in GitHub Desktop.
Save frafra/cdfc98cdbbe93bbdb73ed6363c5c613f to your computer and use it in GitHub Desktop.
Allow GDAL vsicurl to fetch streamed replies and caching
vcl 4.1;
import dynamic;
backend default none;
sub vcl_init {
new d = dynamic.director(port = "80");
}
sub vcl_recv {
# Connect to haproxy, since Varnish cannot connect to HTTPS
set req.backend_hint = d.backend("haproxy");
# Specify the Host header
set req.http.host = "ipt.nina.no";
}
sub vcl_backend_response {
# Provides Content-Lenght header, needed by GDAL vsicurl
set beresp.do_stream = false;
# Drop Tomcat session ID to allow caching
unset beresp.http.Set-Cookie;
}
services:
haproxy:
image: haproxy:2.8
volumes:
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
proxy:
image: varnish
volumes:
- ./default.vcl:/etc/varnish/default.vcl:ro
- type: tmpfs
target: /var/lib/varnish/varnishd:exec
ports:
- 8080:80
global
maxconn 15
defaults
mode http
timeout connect 5000
timeout check 5000
timeout client 30000
timeout server 30000
frontend nina
bind *:80
default_backend nina-url
backend nina-url
server xxx nina.no:443 ssl verify none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment