This question has been flagged
3 Replies
8490 Views

Ok, I'm using Odoo 12 on Ubuntu 18.04, nginx/1.14.0 with letsencrypt for my ssl certs.

Most everything is working perfectly, however links from the website that redirect are returning the variable I named in the nginx domain config file instead of using the domain.

# Odoo servers
upstream odoo {
      server 127.0.0.1:8069;
}
upstream odoochat {
     server 127.0.0.1:8072;
}
# HTTP -> HTTPS
server {
      if ($host = www.qa.moddulu.com) {
            return 301 https://$host$request_uri;
      } # managed by Certbot
      if ($host = qa.moddulu.com) {
            return 301 https://$host$request_uri;
      } # managed by Certbot
      listen 80;
      server_name www.qa.moddulu.com qa.moddulu.com;
      include snippets/letsencrypt.conf;
      return 301 https://qa.moddulu.com$request_uri;
}
# WWW -> NON WWW
server {
      listen 443 ssl http2;
      server_name www.qa.moddulu.com;
      ssl_trusted_certificate /etc/letsencrypt/live/qa.moddulu.com/chain.pem;
      include snippets/ssl.conf;
      include snippets/letsencrypt.conf;
      return 301 https://qa.moddulu.com$request_uri;
      ssl_certificate /etc/letsencrypt/live/qa.moddulu.com/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/qa.moddulu.com/privkey.pem; # managed by Certbot
}
server {
      listen 443 ssl http2;
      server_name qa.moddulu.com;
      proxy_read_timeout 720s;
      proxy_connect_timeout 720s;
      proxy_send_timeout 720s;
      # Proxy headers
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Real-IP $remote_addr;
      # SSL parameters
      ssl_trusted_certificate /etc/letsencrypt/live/qa.moddulu.com/chain.pem;
      include snippets/ssl.conf;
      include snippets/letsencrypt.conf;
      return 301 https://qa.moddulu.com$request_uri;

      ssl_certificate /etc/letsencrypt/live/qa.moddulu.com/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/qa.moddulu.com/privkey.pem; # managed by Certbot
}
server {
      listen 443 ssl http2;
      server_name qa.moddulu.com;
      proxy_read_timeout 720s;
      proxy_connect_timeout 720s;
      proxy_send_timeout 720s;
      # Proxy headers
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Real-IP $remote_addr;
      # SSL parameters
      ssl_trusted_certificate /etc/letsencrypt/live/qa.moddulu.com/chain.pem;
      include snippets/ssl.conf;
      include snippets/letsencrypt.conf;
      # log files
      access_log /var/log/nginx/qa.moddulu.com.access.log;
      error_log /var/log/nginx/qa.moddulu.com.error.log;
      # Handle longpoll requests
      location /longpolling {
      proxy_pass http://odoochat;
}
# Handle / requests
location / {
      proxy_redirect off;
      proxy_pass http://odoo;
}
# Cache static files
location ~* /web/static/ {
      proxy_cache_valid 200 90m;
      proxy_buffering on;
      expires 864000;
      proxy_pass http://odoo;
}
# Gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;

ssl_certificate /etc/letsencrypt/live/qa.moddulu.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/qa.moddulu.com/privkey.pem; # managed by Certbot
}

so, for example, I'm trying to log in and and the url is going to 'https://odoo/web' instead of 'https://qa.moddulu.com/web'. the 'odoo' in the link changes with whatever the upstream variable for the server is. I haven't been able to find a solution to this. I've tried rebuilding the server, but that didn't fix the problem.

Avatar
Discard

This is not an Odoo issue.

Author

I'm still looking for help, if anyone can help me with this issue. I'm also using google to host.

Hi ,

I am facing the same issue and using google to host @Cristin Meravi did you ever find a solution?

Best Answer

You should set proxy_mode = True on odoo config

Avatar
Discard
Best Answer

i dont think that is the only solution
must  be  something 
it  was  working  before 

Avatar
Discard
Author Best Answer

Instead of using `upstream odoo` I used `upstream <domain name>`.

Avatar
Discard