keycloak throws 502 bad gateway error

2,140 views
Skip to first unread message

Niveditha Nivi

unread,
Feb 17, 2020, 12:19:43 AM2/17/20
to Keycloak User
Using Nginx as Reverse proxy and AWS classic Loadbalancer.

When I access the keycloak URL it throws 502 bad gateway error.

NGINX LOG:
2020-02-16T12:42:46+00:00   ngix    {"logs":"2020/02/16 12:42:46 [error] 6#6: *110 connect() failed (111: Connection refused) while connecting to upstream, client: 10.255.0.2, server: user.*, request: \"GET / HTTP/1.1\", upstream: \"http://10.0.0.7:8181/\", host: \"user.hellokash.fidorfzco.com\" /foundation-ngix_nginx.1.fe9hroxupg5nxoupeiw56aw54"}
2020-02-16T12:42:47+00:00   ngix    {"logs":"2020/02/16 12:42:47 [error] 6#6: *110 connect() failed (111: Connection refused) while connecting to upstream, client: 10.255.0.2, server: user.*, request: \"GET /favicon.ico HTTP/1.1\", upstream: \"http://10.0.0.7:8181/favicon.ico\", host: \"user.hellokash.fidorfzco.com\", referrer: \"http://user.hellokash.fidorfzco.com/\" /foundation-ngix_nginx.1.fe9hroxupg5nxoupeiw56aw54"}
2020-02-16T12:42:47+00:00   ngix    {"logs":"10.255.0.2 - - [16/Feb/2020:12:42:47 +0000] \"GET /favicon.ico HTTP/1.1\" 502 559 \"http://user.hellokash.fidorfzco.com/\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36\" \"80.227.39.186\" /foundation-ngix_nginx.1.fe9hroxupg5nxoupeiw56aw54"}

Jan Lieskovsky

unread,
Feb 17, 2020, 3:50:26 AM2/17/20
to Niveditha Nivi, Keycloak User
Hello Niveditha,

On Mon, Feb 17, 2020 at 6:19 AM Niveditha Nivi <nivedit...@gmail.com> wrote:
Using Nginx as Reverse proxy and AWS classic Loadbalancer.

When I access the keycloak URL it throws 502 bad gateway error.

NGINX LOG:
2020-02-16T12:42:46+00:00   ngix    {"logs":"2020/02/16 12:42:46 [error] 6#6: *110 connect() failed (111: Connection refused) while connecting to upstream, client: 10.255.0.2, server: user.*, request: \"GET / HTTP/1.1\", upstream: \"http://10.0.0.7:8181/\", host: \"user.hellokash.fidorfzco.com\" /foundation-ngix_nginx.1.fe9hroxupg5nxoupeiw56aw54"}

There might be various reasons, why you are experiencing this kind of errors. Incorrectly configured port number, or
location specification in nginx.conf for example. Are you able to reach that host outside of nginx? If not, I would start
debugging there (confirm Keycloak is reachable on 8181 port etc.)

These blog posts describe NGINX + Keycloak together setup in more details (not focused on AWS though), you might
find useful:

2020-02-16T12:42:47+00:00   ngix    {"logs":"2020/02/16 12:42:47 [error] 6#6: *110 connect() failed (111: Connection refused) while connecting to upstream, client: 10.255.0.2, server: user.*, request: \"GET /favicon.ico HTTP/1.1\", upstream: \"http://10.0.0.7:8181/favicon.ico\", host: \"user.hellokash.fidorfzco.com\", referrer: \"http://user.hellokash.fidorfzco.com/\" /foundation-ngix_nginx.1.fe9hroxupg5nxoupeiw56aw54"}
2020-02-16T12:42:47+00:00   ngix    {"logs":"10.255.0.2 - - [16/Feb/2020:12:42:47 +0000] \"GET /favicon.ico HTTP/1.1\" 502 559 \"http://user.hellokash.fidorfzco.com/\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36\" \"80.227.39.186\" /foundation-ngix_nginx.1.fe9hroxupg5nxoupeiw56aw54"}

--
You received this message because you are subscribed to the Google Groups "Keycloak User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-user/80a5516b-3e65-4503-bdb9-a0e57ced68fa%40googlegroups.com.

HTH

Regards, Jan

Jan Lieskovsky

unread,
Feb 17, 2020, 3:53:40 AM2/17/20
to Niveditha Nivi, Keycloak User

Regards, Jan
Reply all
Reply to author
Forward
0 new messages