I am running "python app.py 135.235.175.28:8080" on VM. Inbound port 8080 is open. Still not able to access end points coded in app.py

Abhay Kumar Singh 0 Reputation points
2025-05-30T15:40:49.6033333+00:00

I am running "python app.py 135.235.175.28:8080" on VM. Inbound port 8080 is open. Still not able to access end points coded in app.py

Azure Virtual Desktop
Azure Virtual Desktop
A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
1,820 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Pramidha Yathipathi 1,135 Reputation points Microsoft External Staff Moderator
    2025-05-30T19:37:40.61+00:00

    Hi Abhay Kumar Singh,

    Is your app actually listening on the external IP? When you run:

    python app.py 135.235.175.28:8080

    Make sure your Python app’s server code is binding to that IP address.

    Most frameworks bind to 127.0.0.1 (localhost) by default, which means external access won’t work.

    What to do:

    Bind to all interfaces by using 0.0.0.0, like: python app.py 0.0.0.0:8080

    or in your app code, ensure the server binds to 0.0.0.0 instead of a specific IP.

    Verify the app is running and listening on the VM, run:

    netstat -tuln | grep 8080

    You should see something like:

    tcp        0      0 0.0.0.0:8080            0.0.0.0:               LISTEN*

    If it says 127.0.0.1:8080, then it’s only listening on localhost.

    Firewall & NSG: You said inbound port 8080 is open — double-check both:

    VM’s OS firewall (e.g., ufw, firewalld)

    Azure NSG (Network Security Group) inbound rules for the VM’s subnet or NIC

    Make sure both allow inbound TCP traffic on port 8080.

    Try curling from the VM itself run on VM:

    curl http://localhost:8080

    curl http://135.235.175.28:8080

    If localhost works but the external IP doesn’t, binding is the issue.

    If neither works, the app may not be running or is failing.

    Check the app logs

    Maybe the app is crashing or throwing errors during startup.

    If you found information is helpful, please click "Upvote" on the post to let us know.

    If you have any further queries feel free to ask us we are happy to assist you.

    Thank You.

     


  2. Alex Burlachenko 8,315 Reputation points
    2025-06-04T07:49:22.3233333+00:00

    hi )) Abhay Kumar Singh

    my friend, let me help u figure this out. first off, good job checking the inbound port rules )) but there's more to it when dealing with vms in azure. So u ran "python app.py 135.235.175.28:8080".... so that's cool, but is the app actually binding to 0.0.0.0 or just localhost? check ur app.py code. if it's listening only on 127.0.0.1, it won’t accept external connections. u gotta make sure it’s set to 0.0.0.0 to allow traffic from outside )) here's how u can tweak it in flask for example

    if __name__ == '__main__':
        app.run(host='0.0.0.0', port=8080)
    

    next, even if the port is open in azure, the vm’s own firewall might block it. run this on ur linux vm to check

    sudo ufw status
    
    

    if its active, u might need to allow port 8080

    sudo ufw allow 8080
    
    

    also, check the azure network security group (nsg). sometimes the inbound rule is there, but the priority gets messed up )) make sure ur rule isn’t being overridden by a deny rule with higher priority. microsoft doc on nsg rules microsoft nsg docs

    and one more thing )) if ur vm has a public ip, but the app still ain’t reachable, try accessing it from inside the vm first

    curl http://localhost:8080
    
    

    if that works, then the issue is definitely with networking, not the app itself.

    azure sometimes puts vms behind a load balancer or nat gateway. if ur vm is part of a bigger setup, u might need extra config. but for now, start with these steps and lmk how it goes :))

    and yea, microsoft docs are a lifesaver, always check em out %)))))

    Best regards,

    Alex

    and "yes" if you would follow me at Q&A - personaly thx.
    P.S. If my answer help to you, please Accept my answer
    PPS That is my Answer and not a Comment
    

    https://ctrlaltdel.blog/

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.