10 months ago
i have python service (Flask) as server and go service as client. the flask server run on port 8080. i try to access private networking using go by using
resp, err := http.Post(
"http://myflaskserver.railway.internal:8080/api/test",
"application/json",
bytes.NewBuffer(jsonData),
)
but the return error is:
Post "http://myflaskserver.railway.internal:8080/api/test";: dial tcp [ip addr]:8080: connect: connection refused
routing from flask is
@app.route('/api/test', methods=['POST'])
@limiter.limit("100 per minute")
def test():
try:
messages = request.get_json()
logging.info("msg recive")
logging.info(str(messages))
return jsonify({
"status":"ok",
"message":str(messages),
}), 200
except Exception as e:
logging.error(f"Error processing data: {str(e)}")
return jsonify({'error': 'Internal server error'}), 500
0 Replies
10 months ago
Railway's private networking only supports IPv6, docs and examples can be found here: https://docs.railway.com/guides/private-networking
10 months ago
In addition to that, I recommend you referencing the private domain environment variable, instead of hard coding the said private domain in place.
10 months ago
This can also be found in the same documentation for private networking:
10 months ago
!s
Status changed to Solved brody • 10 months ago