server {
    listen 80;
    server_name dns-staging.rebreak.de;
    return 301 https://dns-staging.rebreak.de$request_uri;
}

server {
    listen 443 ssl;
    server_name dns-staging.rebreak.de;

    ssl_certificate     /etc/letsencrypt/live/staging.rebreak.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/staging.rebreak.org/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    location /dns-query {
        proxy_pass http://127.0.0.1:5354/dns-query;
        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-Proto $scheme;
        proxy_connect_timeout 5s;
        proxy_send_timeout 10s;
        proxy_read_timeout 10s;
    }

    location /health {
        return 200 "OK\n";
        add_header Content-Type text/plain;
    }
}