0
votes

I deployed flask application in GCP compute engine. It is exposed at 5000 port. When I tried to do curl from vm, curl "localhost:5000/health", I am getting response "service up". But when I tried accessing through public IP, I am not able to access. I have created network firewall rule allowing both http & https traffic and for all the ports and for all IP (0.0.0.0/0).

Please let me know, if I am missing anything here.

1
Issue is resolved, problem was in flask code, changed host from localhost to 0.0.0.0 and then it worked. app.run(host='localhost',debug=True,port=5000) to app.run(host='0.0.0.0',debug=True,port=5000)Rakesh
Please consider posting your solution as the answer to this question. This will make it more visible to other community members who encounter the same issue. ThanksFarid Shumbar

1 Answers

1
votes

Posting this answer based on the solution that was provided by @Rakesh.

Issue got resolved by changing the local host in the flask code to 0.0.0.0.

So the final configuration looks as follows:

app.run(host='0.0.0.0',debug=True,port=5000)