betagouv/service-national-universel

View on GitHub
admin/docker_nginx.conf

Summary

Maintainability
Test Coverage
server {
    listen       8080  default_server;


    if ($http_x_forwarded_proto = "http") {
        return 301 https://${NGINX_HOSTNAME}$request_uri;
    }

    if ($host != "${NGINX_HOSTNAME}"){
        return 301 https://${NGINX_HOSTNAME};
    }

    # hsts
    add_header Strict-Transport-Security: "max-age=31536000; includeSubDomains; preload";
    # helmet
    add_header X-Content-Type-Options: "nosniff";
    add_header X-Frame-Options: "DENY";
    add_header X-Download-Options: "noopen";
    add_header Referrer-Policy: "no-referrer";

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        try_files $uri /index.html;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}