Skip to content
Public domain returns 404 while container returns 401 internally – anyone experienced this?
v7nc35
OP

a month ago

Hi Railway Community,

We’re experiencing a strange HTTP routing issue and would appreciate advice from anyone who has encountered something similar.

The problem: Our Railway service deploys successfully, starts normally and responds correctly to HTTP requests inside the container. However, the public Railway-generated domain returns HTTP 404 while the container is running.

Our setup:

  • Project: modularmind-alpaca-paper
  • Environment: paper-staging
  • Service: alpaca-paper-observer
  • Region: iad
  • Public domain: alpaca-paper-observer-paper-staging.up.railway.app
  • Target port: 8787
  • Python HTTP server listening on 0.0.0.0:8787
  • Docker deployment
  • Private Networking enabled (IPv4 & IPv6)
  • Auto Deploy disabled intentionally
  • Restart policy: NEVER

What we’ve verified:

On October 17, 2026:

  • 15:59:09 UTC – Container starts successfully.
  • Internal GET /status to 127.0.0.1:8787 returns HTTP 401, as expected without authentication.
  • Internal response includes X-Observer-Handler: readonly-archive-v1.
  • 15:59:58 and 16:00:02 UTC – External GET /status requests return HTTP 404 in 1–4 ms.
  • No matching external requests appear in our instrumented Python HTTP handler logs.
  • 16:04:09 UTC – Container shuts down normally after its configured 300-second test window.

The browser response is:

{"status": "NOT_FOUND"}

Railway HTTP logs confirm the external 404 responses, with no upstream errors recorded for those requests.

We also noticed a separate message in Railway’s GitHub integration settings:

Could not load branches. Retry

The repository is still connected to main, and manually approved deployments build successfully.

What we’ve already ruled out:

  • The application not starting
  • An incorrect public target port
  • A failed internal HTTP handler
  • Private Networking being disabled
  • A Docker build failure

We’ve also seen related Railway Community posts where similar issues were traced to edge routing, private networking or underlying infrastructure problems. However, we don’t want to assume the cause is identical.

Our questions:

  1. Has anyone experienced a Railway-generated *.up.railway.app domain returning 404 while the application works correctly inside the running container?
  2. Could this indicate a stale edge route or incorrect deployment/upstream mapping?
  3. Is there a safe way to refresh or repair the public routing without recreating the service?
  4. Could the Could not load branches warning be related, or is it likely independent?

We want to preserve the existing persistent volume, application configuration and credentials.

We’d especially appreciate input from Railway staff or anyone who has successfully resolved this exact internal-401/external-404 discrepancy.

Thanks in advance!

$10 Bounty

2 Replies

Railway
BOT

a month ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • about 1 month ago


taha-rafi

a month ago

The immediate 404 NOT_FOUND response with no application logs suggests the request is not reaching the Python service. Please verify that the public domain belongs to the correct service and environment, and that its target port matches the listening port (8787). Confirm the app binds to 0.0.0.0 and remains running during the test. If those settings are correct, try regenerating the Railway-provided domain, provided changing the hostname is acceptable. If the issue persists, Railway support may need to inspect the edge routing.


sundayabasi684-byte
Top 5% Contributor

a month ago

Hi @v7nc35,

Since internal curl returned 401 with X-Observer-Handler: readonly-archive-v1, your container is healthy. The 404 in 1–4ms without app logs means Railway’s edge proxy is dropping requests before hitting your app.

Here are direct answers to your 4 questions:

1 & 2. Cause (Lifecycle & Dual-Stack)

  • Short 300s Lifecycle: With Restart policy: NEVER, testing 49 seconds post-launch often catches Railway's edge proxy while it is still updating upstream routing tables for a newly started container.

  • IPv6 Private Networking: Since Private Networking is enabled, bind Python to IPv6 / dual-stack (::) rather than strictly IPv4 (0.0.0.0) so proxy traffic forwards correctly:

    
    server_address = ('::', 8787)

Safe Route Repair (Without Losing Volumes/Domains)

Do NOT recreate the service or regenerate the domain. To force an edge routing re-sync safely:

Go to alpaca-paper-observer > Settings > Public Networking.

Change the Target Port to 8788, save, and immediately set it back to 8787.

This forces an Anycast proxy re-sync across Railway’s edge without deleting persistent storage or credentials.

GitHub "Could not load branches" Warning

This is an isolated dashboard OAuth/API polling timeout and completely unrelated to runtime networking.

Next Test:

Extend the test window to 600s, let the container run for >2 minutes, and test via curl -v https://alpaca-paper-observer-paper-staging.up.railway.app/status to check the x-railway-edge header.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...