I keep on getting 502 Bad Gateway: Registered endpoint failed to handle the request.


Ushani Balasooriya
 

I started to access http and https bpth. But it gives me the below error when I browse the app.
I have installed PCF dev in my local machine.
This is my route: Routeshttps://is530.local.pcfdev.io


2017-09-13T15:21:45.139+05:30 [RTR/0] [OUT] is530.local.pcfdev.io - [2017-09-13T09:51:45.137+0000] "GET /carbon HTTP/1.1" 502 0 67 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" "192.168.11.1:60550" "10.0.2.15:60055" x_forwarded_for:"-" x_forwarded_proto:"https" vcap_request_id:"66256b25-32b9-4769-72f0-add0592e0b59" response_time:0.002344385 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714" app_index:"0"
2017-09-13T15:22:15.846+05:30 [RTR/0] [OUT] is530.local.pcfdev.io - [2017-09-13T09:52:15.845+0000] "GET /carbon HTTP/1.1" 502 0 67 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" "192.168.11.1:60550" "10.0.2.15:60055" x_forwarded_for:"-" x_forwarded_proto:"https" vcap_request_id:"524a30a6-8cb4-44cc-7937-96a7fcae20f5" response_time:0.000872472 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714" app_index:"0"
2017-09-13T15:22:19.309+05:30 [RTR/0] [OUT] is530.local.pcfdev.io - [2017-09-13T09:52:19.308+0000] "GET /carbon HTTP/1.1" 502 0 67 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" "192.168.11.1:41342" "10.0.2.15:60055" x_forwarded_for:"-" x_forwarded_proto:"http" vcap_request_id:"c32925f5-d994-4e42-606a-86b5f52159f4" response_time:0.000675021 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714" app_index:"0"
2017-09-13T15:22:25.925+05:30 [RTR/0] [OUT] is530.local.pcfdev.io - [2017-09-13T09:52:25.924+0000] "GET /carbon HTTP/1.1" 502 0 67 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" "192.168.11.1:41342" "10.0.2.15:60055" x_forwarded_for:"-" x_forwarded_proto:"http" vcap_request_id:"183c95fe-2619-4ecb-7739-585f7763d9f1" response_time:0.000756516 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714" app_index:"0"


Lucas Reginato
 

Hi Ushani,

I have the same experience, and this is what I found:

1) If your application uses HTTP, everything works just fine.
You will access the HTTPS endpoint (provided by the Load Balancer) and you
can access your app.

2) If your application uses HTTPS, you will receive a 502 (Bad Gateway)
when you try to access it.
This happens because the GoRouter only talks HTTP to the application.
I mean, PCF Dev will provide you a HTTPS endpoint, but that is the HTTPS
Load Balancer endpoint.
The Load Balancer will send the HTTPS request to the GoRouter layer, and
GoRouter will only talk HTTP to the application.
So, if the application talks HTTPS, nahhhh, bad communication, and the
request fails with a 502.

I was able to enable HTTPS in my application by creating a TCP route to my
application.

I hope that helps.
And I would like to listen what others engineers done to fix this.

Thanks,

-Lucas Reginato

On Wed, Sep 13, 2017 at 11:58 AM, Ushani Balasooriya <ushanib(a)gmail.com>
wrote:

I started to access http and https bpth. But it gives me the below error
when I browse the app.
I have installed PCF dev in my local machine.
This is my route: Routeshttps://is530.local.pcfdev.io


2017-09-13T15:21:45.139+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:51:45.137+0000] "GET /carbon HTTP/1.1" 502 0 67 "-"
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101
Firefox/51.0" "192.168.11.1:60550" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"https" vcap_request_id:"66256b25-32b9-4769-72f0-add0592e0b59"
response_time:0.002344385 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"
2017-09-13T15:22:15.846+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:52:15.845+0000] "GET /carbon HTTP/1.1" 502 0 67 "-"
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101
Firefox/51.0" "192.168.11.1:60550" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"https" vcap_request_id:"524a30a6-8cb4-44cc-7937-96a7fcae20f5"
response_time:0.000872472 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"
2017-09-13T15:22:19.309+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:52:19.308+0000] "GET /carbon HTTP/1.1" 502 0 67 "-"
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101
Firefox/51.0" "192.168.11.1:41342" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"http" vcap_request_id:"c32925f5-d994-4e42-606a-86b5f52159f4"
response_time:0.000675021 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"
2017-09-13T15:22:25.925+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:52:25.924+0000] "GET /carbon HTTP/1.1" 502 0 67 "-"
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101
Firefox/51.0" "192.168.11.1:41342" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"http" vcap_request_id:"183c95fe-2619-4ecb-7739-585f7763d9f1"
response_time:0.000756516 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"


--
Lucas Reginato


Ronak Banka
 

Hi Ushani,

From logs what I can see is that application is trying to access "/carbon"
route instead of "/", which is https://is530.local.pcfdev.io/carbon

how are the application routes configured? you can configure the path
during cf push

Thanks
Ronak


On Wed, Sep 13, 2017 at 4:31 PM, Lucas Reginato <lucas.reginato(a)gmail.com>
wrote:

Hi Ushani,

I have the same experience, and this is what I found:

1) If your application uses HTTP, everything works just fine.
You will access the HTTPS endpoint (provided by the Load Balancer) and you
can access your app.

2) If your application uses HTTPS, you will receive a 502 (Bad Gateway)
when you try to access it.
This happens because the GoRouter only talks HTTP to the application.
I mean, PCF Dev will provide you a HTTPS endpoint, but that is the HTTPS
Load Balancer endpoint.
The Load Balancer will send the HTTPS request to the GoRouter layer, and
GoRouter will only talk HTTP to the application.
So, if the application talks HTTPS, nahhhh, bad communication, and the
request fails with a 502.

I was able to enable HTTPS in my application by creating a TCP route to my
application.

I hope that helps.
And I would like to listen what others engineers done to fix this.

Thanks,

-Lucas Reginato

On Wed, Sep 13, 2017 at 11:58 AM, Ushani Balasooriya <ushanib(a)gmail.com>
wrote:

I started to access http and https bpth. But it gives me the below error
when I browse the app.
I have installed PCF dev in my local machine.
This is my route: Routeshttps://is530.local.pcfdev.io


2017-09-13T15:21:45.139+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:51:45.137+0000] "GET /carbon HTTP/1.1" 502 0 67 "-"
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101
Firefox/51.0" "192.168.11.1:60550" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"https" vcap_request_id:"66256b25-32b9-4769-72f0-add0592e0b59"
response_time:0.002344385 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"
2017-09-13T15:22:15.846+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:52:15.845+0000] "GET /carbon HTTP/1.1" 502 0 67 "-"
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101
Firefox/51.0" "192.168.11.1:60550" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"https" vcap_request_id:"524a30a6-8cb4-44cc-7937-96a7fcae20f5"
response_time:0.000872472 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"
2017-09-13T15:22:19.309+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:52:19.308+0000] "GET /carbon HTTP/1.1" 502 0 67 "-"
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101
Firefox/51.0" "192.168.11.1:41342" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"http" vcap_request_id:"c32925f5-d994-4e42-606a-86b5f52159f4"
response_time:0.000675021 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"
2017-09-13T15:22:25.925+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:52:25.924+0000] "GET /carbon HTTP/1.1" 502 0 67 "-"
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101
Firefox/51.0" "192.168.11.1:41342" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"http" vcap_request_id:"183c95fe-2619-4ecb-7739-585f7763d9f1"
response_time:0.000756516 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"


--
Lucas Reginato


Ushani Balasooriya
 

Hi Lucas,

Thanks can you guide me how to enable tcp route to the app? I tried below and it failed.

sudo cf map-route is5.3.0 local.pcfdev.io --port 5000
Creating route local.pcfdev.io:5000 for org pcfdev-org / space pcfdev-space as admin...
FAILED
Error resolving route:
Server error, status code: 400, error code: 210001, message: The route is invalid: Port is supported for domains of TCP router groups only.


Ushani Balasooriya
 

Hi Ronak,

That is a context path of my application. But meantime I also just tried without the "/carbon" and just only with "/". But still no luck.


Ronak Banka
 

Ushani , if you have a git repo for your code and can share, it would be
very easy to debug.


On Wed, Sep 13, 2017 at 5:18 PM, Ushani Balasooriya <ushanib(a)gmail.com>
wrote:

Hi Ronak,

That is a context path of my application. But meantime I also just tried
without the "/carbon" and just only with "/". But still no luck.


Ushani Balasooriya
 

Log without /carbon

2017-09-13T14:59:23.865+05:30 [RTR/0] [OUT] is530.local.pcfdev.io - [2017-09-13T09:29:23.864+0000] "GET / HTTP/1.1" 502 0 67 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" "192.168.11.1:60056" "10.0.2.15:60055" x_forwarded_for:"-" x_forwarded_proto:"https" vcap_request_id:"57887b42-bda3-41fd-7d4d-0617df1ef8e4" response_time:0.000888627 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714" app_index:"0"
2017-09-13T15:11:31.054+05:30 [RTR/0] [OUT] is530.local.pcfdev.io - [2017-09-13T09:41:31.053+0000] "GET / HTTP/1.1" 502 0 67 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" "192.168.11.1:60150" "10.0.2.15:60055" x_forwarded_for:"-" x_forwarded_proto:"https" vcap_request_id:"dabe350e-e64e-47e0-5d35-b2f171f3846b" response_time:0.001140777 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714" app_index:"0"
2017-09-13T15:13:28.399+05:30 [RTR/0] [OUT] is530.local.pcfdev.io - [2017-09-13T09:43:28.397+0000] "GET / HTTP/1.1" 502 0 67 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" "192.168.11.1:60350" "10.0.2.15:60055" x_forwarded_for:"-" x_forwarded_proto:"https" vcap_request_id:"910e4607-6d15-41a9-5fa6-a217a2622fb6" response_time:0.001524459 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714" app_index:"0"


Ushani Balasooriya
 

Hi Ronak,

Im trying to deploy WSO2 IS docker image on PCF.

https://github.com/wso2/docker-is/tree/release-5.3.0/dockerfile


Lucas Reginato
 

Hi Ushani,

Please try the following:

1) Once your application is deployed, execute:

a) cf create-route pcfdev-space tcp.local.pcfdev.io --random-port
Creating route tcp.local.pcfdev.io for org pcfdev-org / space pcfdev-space
as admin...
OK
Route tcp.local.pcfdev.io:61015 has been created

b) cf map-route <app-name> tcp.local.pcfdev.io --port 61015

2) Access your application https://<url to the app>:61015.
You should see your certificate (I am assuming you have configured one).

In my example, the port allocated was 61015.
But it could be a different port in your case.
So please check the port that will be allocated by create-route command.

Hope it helps.
:)

Thanks,

-Lucas Reginato


On Wed, Sep 13, 2017 at 2:01 PM, Ushani Balasooriya <ushanib(a)gmail.com>
wrote:

Log without /carbon

2017-09-13T14:59:23.865+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:29:23.864+0000] "GET / HTTP/1.1" 502 0 67 "-" "Mozilla/5.0
(X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" "
192.168.11.1:60056" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"https" vcap_request_id:"57887b42-bda3-41fd-7d4d-0617df1ef8e4"
response_time:0.000888627 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"
2017-09-13T15:11:31.054+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:41:31.053+0000] "GET / HTTP/1.1" 502 0 67 "-" "Mozilla/5.0
(X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" "
192.168.11.1:60150" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"https" vcap_request_id:"dabe350e-e64e-47e0-5d35-b2f171f3846b"
response_time:0.001140777 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"
2017-09-13T15:13:28.399+05:30 [RTR/0] [OUT] is530.local.pcfdev.io -
[2017-09-13T09:43:28.397+0000] "GET / HTTP/1.1" 502 0 67 "-" "Mozilla/5.0
(X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" "
192.168.11.1:60350" "10.0.2.15:60055" x_forwarded_for:"-"
x_forwarded_proto:"https" vcap_request_id:"910e4607-6d15-41a9-5fa6-a217a2622fb6"
response_time:0.001524459 app_id:"faf5b9d6-a48f-499e-a5f8-35286c921714"
app_index:"0"


--
Lucas Reginato