Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    pfSense and odoo and nginx: Error 502, bad Gateway

    DHCP and DNS
    1
    1
    829
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • U
      unique24
      last edited by unique24

      Hello,

      first: maybe this is a problem from odoo or nginx, but would be great if you can help me.

      The situation:
      LTE Router => pfsense (WAN) => pfsense (LAN) => odoo Server (Ubuntu server 16.04)

      The Problem:
      When I restart the LTE Router, I cannot connect the webservice over the internal network from the odoo Server with:
      https://portal.company.com
      Error 502, bad gateway.

      Temporary solution:
      restart odoo

      Now I want to fix this problem.

      My Setup in pfSense:
      odoo server: receive fixed IP via DHCP (192.168.0.202)
      DNS entry to reach the server in local network: https://portal.company.com
      Port Forwarding to reach the odoo server also from external

      My Setup in nginx:

      #worker_processes  1;
      
      #events {
      #    worker_connections  1024;
      #}
      
              upstream portal.company.com {
                      server portal.company.com:8069 weight=1 fail_timeout=0;
              }
      
              upstream portal.company.com-im {
                      server portal.company.com:8072 weight=1 fail_timeout=0;
              }
      
      
      
              server {
              listen  80;
              server_name portal.company.com;
      
              location /socket.io {
      #               proxy_buffer_size 128k;
                      proxy_send_timeout 600s;
                      proxy_read_timeout 600s;
                      proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
      
                      proxy_pass   http://127.0.0.1:8068;
                      proxy_http_version 1.1;
                      proxy_set_header Upgrade $http_upgrade;
                      proxy_set_header Connection "upgrade";
                      proxy_set_header Host $host;
      
                      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;
                      proxy_redirect off;
              }
      
              location / {
                      proxy_redirect off;
                      proxy_pass http://portal.company.com;
              }
      
              location /longpolling {
                      proxy_pass http://portal.company.com-im;
              }
      
              location /web/static/ {
                      proxy_cache_valid 200 60m;
                      proxy_buffering on;
                      expires 864000;
                      proxy_pass http://portal.company.com;
              }
       }
      
      

      Maybe someone can see the problem?

      Thank you!

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.