Search This Blog

Thursday, March 7, 2019

pcf tcp routing ... will make you cry..

tcp routing in pcf can be a pain in the A*** believe me..
here is what you can do .. if you app spring or whatever is listening on a port like 8080 
exposed from SERVER_PORT=$PORT via buildpack .. which can also be configured in application.properties 
of boot like server.port = 9080 or whatever.

Point is , if http app then pcf will directly route traffic via route to your app on 80/443 else you will have to create
tcp domain and route and a router group , can use default tcp router group and get the traffic on non tcp port.

also you can see if you can run your non http app on 443 if thats possible.
if you are bound to use some other port, you gotta configure all th is.

you can ssh in the cf app using cf ssh app name and do a netstat -an and ps-ef to see which 
port your app is listening to also you directly run java via the /app/.java_buildpack/.././java -cp and your main file name 
if you have a normal java app and you are listening to a port inside your code..

i tried to curl from outside container  to a spring hello world and it will let me curl the https endpoint even 
though the boot was running on 8008 on container.. and when i was trying to run a java jar listening on 9877 
it will let me curl the end point https one but it will give 502 bad gateway.. i guess because the endpoint is expecting 
non http traffic ,, i mean tcp traffic .. and cf router gives bad gateway error..

point is... get the admin rights and configure tcp routing.. or find if your app can run on 443/80 even if tcp traffic.. try it.. 



No comments:

Post a Comment