codevalet/proxy/conf.d/webapp.conf

55 lines
1.2 KiB
Plaintext

# Basic configuration for the reverse proxy in front of "everything"
#
# This should manage the default proxying
server {
listen 80;
server_name codevalet.io;
location ^~ /.well-known/acme-challenge {
root /var/www/letsencrypt;
}
location / {
return 301 https://$server_name$request_uri;
root /usr/share/nginx/html;
}
}
server {
listen 443 ssl http2;
server_name codevalet.io;
include /etc/nginx/vars.conf;
# Grab all the dynamically generated routes, blech.
# Need to do this before the catch-all location below
include /etc/nginx/monkeys.conf;
location /canary {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
rewrite ^/canary/(.*) /$1 break;
proxy_pass http://$canary:$canary_port;
}
location / {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://$webapp:$webapp_port;
}
}
# vim: sw=2 ts=2 et