HTTPS reverse proxy with NGINX

Does anyone have an example of a working configuration with nginx reverse proxy?

What is wrong with the configuration below?

server {
        listen 80;
        server_name nuxeo.myserver.com;
        return 301 https://$host$request_uri;

}



server {

        listen 443 ssl;
        server_name nuxeo.myserver.com;

    include snippets/ssl-generic.conf;

    ssl_certificate /etc/letsencrypt/live/nuxeo.myserver.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/nuxeo.myserver.com/privkey.pem;

    client_max_body_size 1024M;

    if ($scheme = http) {
        return 301 https://$server_name$request_uri;
}

    location / {
        rewrite ^/(.*)$ /nuxeo/$1 last;
    }

    location /nuxeo/ {
        proxy_pass http://10.192.65.67:8080/nuxeo/;
        proxy_set_header nuxeo-virtual-host "https://$server_name/";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_pass_header Set-Cookie;
        proxy_connect_timeout 600;
        proxy_send_timeout 600;
        proxy_read_timeout 600;
        send_timeout 600;
        proxy_buffering off;
  }
}
0 votes

2 answers

1094 views

ANSWER



    location /nuxeo/ {
        proxy_pass http://10.192.65.67:8080/nuxeo/;

Wouldn't this forward /nuxeo/ to http://.../nuxeo/nuxeo? (nginx novice here)

This is working for me.

    location /nuxeo {
        proxy_ignore_client_abort on;
        proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
        proxy_pass http://127.0.0.1:8080;
0 votes



0 votes



Hi, thanks for replying, but unfortunately the only information about Nginx in that documentation url is:

"Ngnix Issue

Due to a Nginx headers filtering, you must disable the check on invalid headers:

ignore_invalid_headers off"

Is there any example Nginx configuration as a reverse proxy?

02/08/2022