2

We have a reverse proxy server on nginx for a bamboo server but it gives a 502 bad gateway but accessible from reverse proxy server(both centos).

nginx.conf:

 server {
listen 80;
server_name bamboo.test.foo.com;

access_log  /var/log/nginx/bamboo.test.foo.access.log  main;
  location /bamboo {
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://192.168.10.5:8085;
    client_max_body_size 10M;
   }
proxy_connect_timeout       600;
proxy_send_timeout          600;
proxy_read_timeout          600;
    send_timeout                600;
  }

access log:

81.82.215.59 - - [07/Dec/2016:16:19:39 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36" "-"

81.82.215.59 - - [07/Dec/2016:16:19:39 +0000] "GET /favicon.ico HTTP/1.1" 502 575 "http://bamboo.test.foo.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36" "-"
  • 1
    Bad gateway usually means the destination server (Bamboo) isn't responding properly. Your question is confusing though - you've said it's accessible from reverse proxy, but it isn't clear if you mean via Nginx or directly. You also need to describe what problem solving steps you've tried, and provide access and error logs for Nginx and Bamboo. Please edit your question to clarify and add this information. – Tim Dec 8 '16 at 1:55
  • Accessible via nginx and directly of course. And we disabled SElinux to find out if that was the problem but it wasn't. – Joske Dec 8 '16 at 1:58
  • I Will provide the logs later. – Joske Dec 8 '16 at 1:59
8

I had SELinux enabled, which blocked Nginx from making outbound connections.

You can check this with:

# getenforce

If SELinux is on and you're experiencing this, you might try setting httpd_can_network_connect to true, and then restarting nginx:

# setsebool -P httpd_can_network_connect true
  • 2
    created an account just to upvote. this fixed it – scott Jul 18 '17 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.