I have some problems with redirecting in Odoo. I configured Nginx and install Odoo but the main problem that I use external IP for which used 2 odoo instances on different ports. I need to connect through port to another odoo instance. I made it, just using external ip + port of second instance with redirecting through nginx. But odoo server when we are trying to connect at first time redirects using wsgi with port 80 and it's comes to first instance. How to say to odoo redirect with my port or it better to try it through nginx? Example: Working: http://test-env:5598/web/login Not working: http://test-env:5598/. It redirects to http://test-env:5598/web after that to http://test-env/web/login where ienter image description heret has port 80.
NGINX CONF:
upstream testodoo-server{
server 127.0.0.1:8069;
}
upstream testodoo-server-im{
server 127.0.0.1:8072 weight=1 fail_timeout=0;
}
server {
listen 80;
listen [::]:80;
server_name test-env default;
# Specifies the maximum accepted body size of a client request,
# as indicated by the request header Content-Length.
proxy_read_timeout 7200s;
proxy_connect_timeout 7200s;
proxy_send_timeout 7200s;
client_max_body_size 500m;
fastcgi_read_timeout 7200s;
fastcgi_send_timeout 7200s;
uwsgi_read_timeout 7200s;
# ssl log files
access_log /var/log/nginx/testodoo-access.log;
error_log /var/log/nginx/testodoo-error.log;
keepalive_timeout 90;
# increase proxy buffer to handle some OpenERP web requests
proxy_buffers 16 64k;
proxy_buffer_size 128k;
#general proxy settings
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# set headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_x_forwarded_host;
# Let the Odoo web service know that we’re using HTTPS, otherwise
# it will generate URL using http:// and not https://
proxy_set_header X-Forwarded-Proto http;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_redirect off;
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://testodoo-server;
}
location /longpolling {
proxy_pass http://testodoo-server-im;
}
# cache some static data in memory for 90mins.
# under heavy load this should relieve stress on the odoo web interface a bit.
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://testodoo-server;
}
# Gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
odoo conf:
[options]
; This is the password that allows database operations:
admin_passwd = JsSdfjskak1231dSs
db_host = localhost
db_port = 5432
db_user = testodoo
db_password = testodoo
xmlrpc = True
xmlrpc_interface = 127.0.0.1
proxy_mode = True
netrpc_interface = 127.0.0.1
addons_path =/opt/odoo/dev/myaddons12,/opt/odoo/dev/odoo-12.0/odoo/addons
log_level = debug
logfile = /opt/odoo/dev/log/testodoo.log
webkit_path = /usr/local/bin/wkhtmltopdf
bin_path = /usr/local/bin
limit_memory_hard = 6442450944
limit_memory_soft = 4294967296
limit_request = 8192
limit_time_cpu = 21600
limit_time_real = 1200