map $http_upgrade $guacamole_connection_upgrade { default upgrade; '' close; } server { listen 80; server_name ${EXTERNAL_GUACAMOLE_DOMAIN}; location /.well-known/acme-challenge/ { root /var/www/certbot; } location / { return 301 https://$host$request_uri; } } server { listen 443 ssl; http2 on; server_name ${EXTERNAL_GUACAMOLE_DOMAIN}; ssl_certificate /etc/nginx/ssl/${SSL_CERTIFICATE_FILE}; ssl_certificate_key /etc/nginx/ssl/${SSL_CERTIFICATE_KEY_FILE}; ssl_session_cache shared:SSL:10m; ssl_session_timeout 1d; ssl_session_tickets off; ssl_protocols TLSv1.2 TLSv1.3; client_max_body_size 1g; add_header Strict-Transport-Security "max-age=31536000" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always; location / { # Serve Guacamole at the domain root while retaining its native # /guacamole/ context path on the internal Tomcat service. proxy_pass ${EXTERNAL_GUACAMOLE_UPSTREAM}/guacamole/; proxy_http_version 1.1; 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-Host $host; proxy_set_header X-Forwarded-Proto https; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $guacamole_connection_upgrade; proxy_connect_timeout 30s; proxy_send_timeout 30m; proxy_read_timeout 30m; proxy_request_buffering off; proxy_buffering off; } }