0

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.

2
  • 2
    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) Commented Jul 10, 2021 at 19:13
  • 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. Thanks Commented Jul 12, 2021 at 9:53

1 Answer 1

1

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.