Support Questions

Find answers, ask questions, and share your expertise

Geting 502 Bad Gateway error when trying to open Ambari

avatar
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!

9 REPLIES 9

avatar
Master 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?

avatar
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. 

avatar
Master 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?

avatar
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.

avatar
Master 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

 

 

.

avatar
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 

avatar
New Contributor

hey bro, I got the exact same response from entering the suggested command by @jsensharma, still cannot open Ambari. did you figure it out?

Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 172.XX.184.YYY...
* TCP_NODELAY set
* Connected to 172.XX.184.YYY (172.XX.184.YYY) port 8080 (#0)
* Server auth using Basic with user 'maria_dev'
> GET /api/v1/check HTTP/1.1
> Host: 172.XX.184.YYY:8080
> Authorization: Basic bWFyaWFfZGV2Om1hcmlhX2Rldg==
> 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: Wed, 20 Sep 2023 16:00:20 GMT
Date: Wed, 20 Sep 2023 16:00:20 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 172.XX.184.YYY left intact
* Closing connection 0

 

 

avatar
Community Manager

@drew-chill As this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post. Thanks.


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:

avatar
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