homelab/roles/keycloak/templates/keycloak.conf.j2

30 lines
882 B
Django/Jinja

server {
server_name "keycloak.{{ base_domain }}";
listen 80;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name "keycloak.{{ base_domain }}";
set $keycloak keycloak;
# Security/XSS Mitigation Headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
include /etc/nginx/snippets/authelia-endpoint.conf;
location / {
proxy_pass http://$keycloak:8080;
include /etc/nginx/snippets/authelia-auth.conf;
proxy_set_header Host $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_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_buffering off;
}
}