a month ago
Description of the Issue
I have successfully deployed a Python Flask application via Docker on Railway. The application logs confirm that the Gunicorn server is running correctly, listening on 0.0.0.0:8000, and all custom API endpoints are registered by Flask.
However, the publicly exposed URL is not routing traffic to my Flask application correctly:
Root Endpoint (
/): A GET request to the root URL returns the generic, default "Railway" ASCII art/page instead of the JSON response defined in my Flask app's root override (/).Custom API Endpoints: POST requests to critical, registered API routes (e.g.,
/save_polygon,/process_slopes) consistently return a 404 Not Found error.
This behavior strongly indicates an internal routing or service configuration issue within the Railway project environment, as the issue persists even after exhausting all Flask-side debugging steps.
Error Messages and Observations
Endpoint/Method
Expected Behavior
Observed Response
GET /
Returns JSON status response (defined in server.py override).
Returns the default Railway ASCII art/page (indicating traffic is hitting a misrouted default service).
POST /save_polygon
Returns 200 or 500 (per application logic).
Returns 404 Not Found (indicating the route is not reached by the public URL).
Relevant Log Snippet (Confirming Route Registration):
The application logs clearly show the routes are loaded and active:
INFO:server:Route: /api/tiles/<layer_name>/<int:z>/<int:x>/<int:y>.pbf | Methods: {'OPTIONS', 'GET', 'HEAD'} | Endpoint: get_tile
INFO:server:Route: /save_polygon | Methods: {'OPTIONS', 'POST'} | Endpoint: save_polygon
INFO:server:Route: /process_slopes | Methods: {'OPTIONS', 'POST'} | Endpoint: process_slopes
Troubleshooting Steps Taken
Code Verification: Confirmed via logs that all required routes (
/save_polygon,/process_slopes) are correctly registered by Flask.CORS Configuration: Confirmed CORS is set to allow all origins (
*) with correct headers/methods.Route Definition Strategy: Tested both modular routing (
routes/polygon.py) and direct function definition withinserver.pyto rule out registration conflicts. Neither approach resolved the external 404/root issue.Local Testing: The application works perfectly when run locally (Docker image).
Request for Assistance
Given the Flask logs confirm the routes are active, I believe the traffic is being handled by an incorrect service or proxy setting within the Railway project.
Can you please check the internal routing logic for my project to ensure that the primary publicly exposed URL is correctly pointing to the running Flask/Gunicorn service and not a stale or default deployment?
Link to Deployment/Code :https://earthbenders-analyzer-backend-production.railway.app/
3 Replies
a month ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
a month ago
can you try exposing the app to the port 8080 instead of 8000 ?
a month ago
It was a stupid oversight. I didn't click on create domain. after clicking on it i copied the link, updated my env and everything worked perfectly
Status changed to Solved brody • 30 days ago