RunpodR
Runpod2y ago
akx

TCP Port Not Working

I started a runpod instance and specifed TCP port, I got something like this

Public IP: <iphere>
Internal: 22 External: 35292
Internal: 35293 External: 35293
Internal: 35294 External: 35294

I create a simple app to test out
from flask import Flask

app = Flask(__name__)

@app.route('/hello', methods=['GET'])
def hello_world():
    return {"text": "hello"}

if __name__ == '__main__':
    app.run(debug=True, port=35293)


Now curl http://127.0.0.1:35293/hello is working
but if I change local host with public ip and same port 35293 it gets connection refused
Solution
The issue here is that you need to bind to 0.0.0.0 and not the default of 127.0.0.1 to access the public IP.
Was this page helpful?