Support Questions
Find answers, ask questions, and share your expertise

Geting 502 Bad Gateway error when trying to open Ambari

New Contributor

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? 

Thanks!

7 REPLIES 7

Super Mentor

@yvettew 

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?

New Contributor

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. 

Super Mentor

@yvettew 

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?

New Contributor

Hi,

 

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.

Super Mentor

@yvettew 

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

 

 

.

New Contributor

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
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-Type: text/html
< Content-Length: 173
Content-Length: 173
< Connection: keep-alive
Connection: keep-alive

<
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.15.0</center>
</body>
</html>
* Connection #0 to host sandbox-hdp.hortonworks.com left intact
* Closing connection 0 

New Contributor

 

@yvettew 

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) Lethargic_Beast_0-1641886763821.png

 

1.1) click on i symbol -> then click on site settings 

it will redirect you to that particular tab settings

 

2)

Lethargic_Beast_1-1641886973914.png

 

2.1) click on reset permissions and then click on clear data

 

Now Go back to that ambari login opening site : 

Lethargic_Beast_2-1641887084714.png

click on reload you will find login page here and error issue will be resolved.

 

 

rest permissions and clear data in chrome browser settings

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.