Proxy Passing Configuration?

Discussion in 'Installation/Configuration' started by motermouth15, Oct 5, 2018.

  1. motermouth15

    motermouth15 New Member

    Hey there!
    I feel like I have a pretty complicated setup, but here's my question before I get into how I have everything setup: How do I properly proxy pass all requests for a certain domain onto another virtual machine, keeping original requesting client's IP and info in tact?

    Details:
    I currently am using Proxmox to run my virtual machines. One of those virtual machines is running ISPconfig 3.1.11 with nginx. Currently, my firewall forwards any external request to my ISPconfig VM so that it can serve web pages hosted on it.
    I have another VM that is running Odoo v11 community edition. I created a "website" on ISPconfig for the domain that Odoo will be serving on, and set it up to proxy_pass all requests to my Odoo instance. So, if you were to log into my ISPconfig admin panel, go to 'sites' > 'odoo_domain' > 'Redirect', you'd see the following:
    redirect type: proxy
    path: internal IP of odoo
    rewrite to https: checked

    I also have the following code in the 'proxy directives' box on the options page of the site:
    Code:
    client_max_body_size 100m;
    
    port_in_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Front-End-Https On;
    proxy_set_header X-Real-IP $remote_addr;
    This is working great. If you go to my_odoo_domain.com from either inside/outside of my network, everything is served just fine.

    Problem:
    I noticed that odoo's built-in link tracker wasn't working. it counts from 0 - 1 and never climbs higher than that, resulting in an inability to track marketing campaign results, or the ability to track page hits. I am pretty positive that odoo is seeing every proxied request as coming from the same host (the host being the ispconfig vm because it's forwarding the request versus the actual client's IP), so it counts 1 page hit, but won't continue to increase as it serves the page to others.

    Possible other problem:
    Odoo is designed to serve on port 8069. I followed several guides (all pretty much modeling the same steps) to setup a nginx reverse proxy on the Odoo instance so that it forwards all requests on http or https to port 8069. I did this by installing nginx, and then using this configuration:
    Code:
     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;
    }
    
    
    Is there something that I'm missing in my settings??
    I've also posted this on the Odoo forum's but haven't had any luck with responses: click here

    Thanks in advance for any help, and sorry for the long post - I was trying to provide as many details as possible.
     

Share This Page