Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
Getting 502 intermittently for proxied service from NgInx on Openshift

I'm getting 502 intermittently for the proxied service. I'm trying to setup NgInx proxy in Openshift. It gives 502 Bad Gateway error intermittently. Here's my nginx.conf file.


#user  nobody;
worker_processes  1;
error_log stderr;
events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    server_tokens off;
    sendfile        on;
    tcp_nopush     on;

    gzip on;
    gzip_comp_level 3;

    keepalive_timeout  65;

    underscores_in_headers on;

    server {
        charset utf-8;
        root   /usr/share/nginx/html;
        listen       8443 ssl http2;
        server_name  proxy-svc;
        add_header X-Frame-Options "SAMEORIGIN";
        add_header X-XSS-Protection "1; mode=block";
         # SSL config
        ssl_certificate /etc/tls/private/tls.crt;
        ssl_certificate_key /etc/tls/private/tls.key;
        # Disable SSL and enable TLS
        ssl_protocols TLSv1.2 TLSv1.3;
        # Cipher suits
        ssl_prefer_server_ciphers on;
        ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;

        # SSL session caching
        ssl_session_cache shared:SSL:40m;
        ssl_session_timeout 4h;
        ssl_session_tickets on;
        
        # Enable HSTS
        add_header Strict-Transport-Security "max-age=31536000" always;

        resolver  dns-default.openshift-dns.svc.cluster.local valid=10s;
        
        proxy_set_header        Host                $host;
        proxy_set_header        X-Real-IP           $remote_addr;
        proxy_set_header        X-Forwarded-Proto   $scheme;
        proxy_set_header        X-Forwarded-For     $proxy_add_x_forwarded_for;
        proxy_pass_request_headers on;
        #  Service name: apimanager_svc
        location /apimanager {
            set $upstreamapi https://apimanager_svc.<namespace>.svc.cluster.local:10666/api/v1/;
            proxy_pass  $upstreamapi$request_uri;
        }
        # Service name: ui-svc
        location / {
            set $upstreamui http://ui-svc.<namespace>.svc.cluster.local/;
            proxy_pass  $upstreamui$request_uri;
        }
    }
}

I have added the whole file because I'm not sure if I have missed/incorrectly configured something. The request runs fine for almost 50% of the time. A few points to note:

  1. The proxy is running over https
  2. The 502 error is only observed for apimanager_svc (which is also https)
  3. Both the proxied services use golang beego v2 https://beego.me/

nginx version: nginx/1.18.0 openshift version: 4.7

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!