This question has been flagged
1 Reply
6573 Views

Hello-

Question: How do I configure my nginx reverse proxy correctly so that odoo sees that it is serving unique individuals instead of serving '127.0.0.1' over and over again?

Details:

I followed several guides that helped me install and configure an nginx reverse proxy so that my odoo instance could be called on http/https without specifying 8069 in the url. It works great, except for I realized that the link tracker no longer works. After digging into the logs on odoo, it appears that no matter who is requesting the website, odoo is logging from and serving back too 127.0.0.1 instead of each requesters IP. 

I believe that I'm missing something in my nginx configuration file, but I can't pinpoint where. Any ideas?

 upstream oddo {
    server 127.0.0.1:8069 weight=1 fail_timeout=3000;
}

server {
    listen 443 default;
    server_name MY_ODOO_DOMAIN.com;
    access_log /var/log/nginx/oddo.access.log;
    error_log /var/log/nginx/oddo.error.log;
    ssl on;
    ssl_certificate /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;
    keepalive_timeout 60;
    ssl_ciphers HIGH:!ADH:!MD5;
    ssl_protocols SSLv3 TLSv1;
    ssl_prefer_server_ciphers on;
    proxy_buffers 16 64k;
    proxy_buffer_size 128k;
    
    client_max_body_size 100m;
    
    location / {
    	proxy_redirect off;
        proxy_pass http://oddo;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_set_header Host $host;
        proxy_set_header X-Forward-Proto $scheme;
        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 https;
    }
    location ~* /web/static/ {
        proxy_cache_valid 200 60m;
        proxy_buffering on;
        expires 864000;
        proxy_redirect off;
        proxy_pass http://oddo;
    }
      gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
      gzip on;
}
server {
    listen 80;
    server_name MY_ODOO_DOMAIN.com;
    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^/.*$ https://$host$request_uri? permanent;
    client_max_body_size 100m;
}

Thanks in advance for the help!

Avatar
Discard
Best Answer

Hi,

just read this thread now. It's maybe too late for your post, but just for others to refer:

" odoo is logging from and serving back too 127.0.0.1 instead of each requesters IP. ", the reason is not here, you already set proxy_set_header

but in odoo.conf, you shall set:

proxy_mode = True

Avatar
Discard