# Example: Nginx config for a public domain (e.g. timetracker.techteam.ddns.net)
#
# Use this when nginx is the main reverse proxy (host or another container).
# - Replace timetracker.techteam.ddns.net with your domain.
# - Replace SSL paths with your certs (e.g. Let's Encrypt).
# - If nginx runs INSIDE the same Docker Compose as the app, use:
#     proxy_pass http://app:8080;
#   instead of http://127.0.0.1:8080
#
# Critical: One "location /" proxies ALL paths (including /api/v1/) to the app.
# Do not proxy only "/" or leave "/api" to another server, or the mobile app will get 404.

# server {
#     listen 80;
#     listen [::]:80;
#     server_name timetracker.techteam.ddns.net;
#     return 308 https://$host$request_uri;
# }
#
# server {
#     listen 443 ssl http2;
#     listen [::]:443 ssl http2;
#     server_name timetracker.techteam.ddns.net;
#
#     ssl_certificate     /etc/letsencrypt/live/timetracker.techteam.ddns.net/fullchain.pem;
#     ssl_certificate_key /etc/letsencrypt/live/timetracker.techteam.ddns.net/privkey.pem;
#     ssl_protocols TLSv1.2 TLSv1.3;
#     ssl_ciphers HIGH:!aNULL:!MD5;
#     ssl_prefer_server_ciphers on;
#
#     client_max_body_size 10M;
#     add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
#     add_header X-Frame-Options "DENY" always;
#     add_header X-Content-Type-Options "nosniff" always;
#     add_header Referrer-Policy "strict-origin-when-cross-origin" always;
#
#     location / {
#         proxy_pass http://127.0.0.1:8080;   # or http://app:8080 if nginx is in same Docker network
#         proxy_set_header Host $http_host;
#         proxy_set_header X-Forwarded-Host $http_host;
#         proxy_set_header X-Forwarded-Port $server_port;
#         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_request_headers on;
#         proxy_cookie_path / /;
#     }
#
#     location /socket.io/ {
#         proxy_pass http://127.0.0.1:8080/socket.io/;
#         proxy_http_version 1.1;
#         proxy_set_header Upgrade $http_upgrade;
#         proxy_set_header Connection "upgrade";
#         proxy_set_header Host $http_host;
#         proxy_set_header X-Forwarded-Host $http_host;
#         proxy_set_header X-Forwarded-Port $server_port;
#         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_read_timeout 600s;
#         proxy_send_timeout 600s;
#         proxy_buffering off;
#     }
# }
