Autoscale deployment failing - healthcheck probing wrong port (1104)

My app (Python/Flask/Gunicorn) has been failing to deploy for 24+ hours. The healthcheck keeps trying port 1104, which I never configured. My .replit has no [[ports]] section, app binds to $PORT correctly, /health returns 200. This was deploying fine before. Support ticket [WER9G4-4JXLP] was escalated but no response yet. My app needs updates and I’m totally stuck.

Has anyone gotten around this? seems like a replit infra issue?? thank you

2 Likes

I found this in my deployment logs: forwarding local port 5000 to external port 80 (mapped as 1104). This came from the old [[ports]] section which has since
been removed. It appears Replit’s deployment has cached this stale port mapping. I’ve asked if engineering clear/reprovision the deployment to flush this cached config. I am getting no replies tho. this has not been a fun 24 hours.

1 Like

thanks so much! hoping to hear back. Its frustrating to have support just go silent . Quinn is so responsive at the start but on escalation it goes dead

1 Like

i just logged a new fresh ticket with what action is required in the hope support can help and not wait for escalation. :frowning:

1 Like

ok so I remixed to a brand new repl and the same port 1104 error occurs,
proving this is a platform-level issue, not a cached config problem. (i think )

thanks - there is no code hidden anywhere. quinn has replied again agreeing its likley platfomr level but same answer of they have high demand please be patient.

1 Like

makes sense. must be bigger fires elsewhere

1 Like

i’m coding with claude opus right now (in replit shell) on max plan. its been amazing and 80% cheaper. pretty sure replit use 4.5 too ? that may have changed yesterday

i dunno . i racked up big costs. i was using gem pro 3 to help arhictect design with detailed replit agent prompts and my bill was going up to $50 a day

Okay, here is the issue. It was with my code! I hope this helps others who may hit this. I should point out Replit support did get back to me (I did have to really push though).

Issue:
My before_request handler was using request.headers.get(‘X-Forwarded-Proto’, ‘http’), which defaults missing headers to ‘http’. When Replit’s internal health checker hits http://127.0.0.1:1104/ directly (no proxy, no X-Forwarded-Proto header), the middleware treated it as an external HTTP request and returned a 301 redirect to HTTPS. The health checker followed the redirect and tried HTTPS against Gunicorn, which only serves HTTP, causing the “http: server gave HTTP response to HTTPS client” error loop.

Fix: Changed to request.headers.get(‘X-Forwarded-Proto’) (no default). Internal health check requests with no header now pass through. External requests through the load balancer with X-Forwarded-Proto: http still get redirected to HTTPS as intended.

Separate issue: [[ports]] keeps being auto-added to .replit during deploy. While this wasn’t the primary cause, it would be helpful to know if there’s a way to prevent autoscale deployments from injecting [[ports]] automatically. (Waiting for a reply on this)

2 Likes

Thank you!! This was the root-cause for me and I was able to get my deployment unblocked.