Caddy workaround
Created by: felixfbecker
This is an escape hatch for when Caddy doesn't work. I wasn't able to figure out yet why (more context in this thread), but without HTTPS support, my local dev environment is completely broken because sign-in fails in Chrome.
This allows to add custom gitignored nginx config that gets included. For reference, here is the ssh.nginx.conf
I am using as a workaround:
upstream dev {
server localhost:3080 max_fails=0;
}
server {
listen 443 ssl;
server_name sourcegraph.test;
ssl_certificate ./sourcegraph.test.pem;
ssl_certificate_key ./sourcegraph.test-key.pem;
# Webpack Dev server HMR
location /sockjs-node/ {
proxy_pass http://dev/sockjs-node/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 60d;
}
location / {
proxy_pass http://dev;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
With certificates I created with mkcert sourcegraph.test
in dev/
.
The other commits are for allowing to disable Caddy with an env var, and making the authbind support work for all processes (including nginx), not just Caddy.