# oc.raumkommander.at — Reverse Proxy zu Win11:7030
upstream oc_raumkommander_backend {
    server 100.64.45.99:7030;
}

server {
    listen 443 ssl http2;
    server_name oc.raumkommander.at;

    ssl_certificate /etc/letsencrypt/live/oc.raumkommander.at/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/oc.raumkommander.at/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    # HTTP → HTTPS redirect
    if ($scheme = http) {
        return 301 https://$server_name$request_uri;
    }

    location / {
        proxy_pass http://oc_raumkommander_backend;
        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_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_connect_timeout 30s;
        proxy_read_timeout 60s;
        proxy_send_timeout 60s;
    }

    # Health check endpoint
    location /health {
        proxy_pass http://oc_raumkommander_backend/health;
        proxy_set_header Host $host;
    }
}

server {
    listen 80;
    server_name oc.raumkommander.at;
    return 301 https://$server_name$request_uri;
}
