Hi, I kept getting 502 Bad Gateway nginx/1.15.7 error when I tried to open Ambari with myIP:8080. I'm using a Mac OS system. Is there any way i can fix it?
Can you please share the output of the following curl command from the host where you are running the browser? Just want to see if there are any Network proxy added in front of Ambari which is causing the 502 error?
# curl -iLv -u "admin:admin" -H "X-Requested-By: ambari" -X GET http://$AMBARI_HOSTNAME:8080/api/v1/check
Please replace the admin:admin with your ambari admin username and password and also the $AMBARI_HOSTNAME with the actual FQDN of ambari server. Please share the output of the above curl command .
Also please check your browser setting if it has any Network proxy setting added to it?
Hi, thank you for replying back to my question.
I am new to all of these. Could you make it more clear where should I run this command?
I'm using Mac system, should i type and run them in the terminal? or somewhere in the browser?
Sorry for this dumb questions.
Yes, please try to run the same Curl command from the MAC laptop where you are opening Browser.
Also please check your browser settings to see if it has any network proxy setting added or not?
I checked the settings for my Chrome. there is nothing checked under Proxy setting.
I tried your command in Terminal, but it didn't provide any feedback.
One thing is for sure here is that Ambari is not giving 502 bad gateway error here.
Ambari server runs on Jetty Server (Not on nginx) So definitely the error which you are getting in your browser is not coming from ambari server. It mist be coming from some nginx server as we see
502 Bad Gateway nginx/1.15.7
Whatever output was generated from the curl command can you share that same. Even if it is blank output can you please share the screenshot of the error or the browser debugger console output ?
# curl -iLv -u admin:admin -H "X-Requested-By: ambari" -X GET http://$AMBARI_HOSTNAME:8080/api/v1/check
I'm getting the same issue. As you said, I think it might be coming from Nginx server. This is what I get in the response of cUrl request:
Andreas-MBP:etc aarrotta$ curl -iLv -u "admin:admin" -H "X-Requested-By: ambari" -X GET http://sandbox-hdp.hortonworks.com:8080/api/v1/check
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying ::1...
* TCP_NODELAY set
* Connected to sandbox-hdp.hortonworks.com (::1) port 8080 (#0)
* Server auth using Basic with user 'admin'
> GET /api/v1/check HTTP/1.1
> Host: sandbox-hdp.hortonworks.com:8080
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.64.1
> Accept: */*
> X-Requested-By: ambari
< HTTP/1.1 502 Bad Gateway
HTTP/1.1 502 Bad Gateway
< Server: nginx/1.15.0
< Date: Mon, 15 Jun 2020 08:23:06 GMT
Date: Mon, 15 Jun 2020 08:23:06 GMT
< Content-Type: text/html
< Content-Length: 173
< Connection: keep-alive
<head><title>502 Bad Gateway</title></head>
<center><h1>502 Bad Gateway</h1></center>
* Connection #0 to host sandbox-hdp.hortonworks.com left intact
* Closing connection 0
in that pop up window copy the url and paste it in normal chrome browser and then follow the below steps to get rid from 500 error in ambari.
1.1) click on i symbol -> then click on site settings
it will redirect you to that particular tab settings
2.1) click on reset permissions and then click on clear data
Now Go back to that ambari login opening site :
click on reload you will find login page here and error issue will be resolved.
rest permissions and clear data in chrome browser settings