Public domain returns 401 Unauthorized on all endpoints (/, /health, /version) from railway-hikari edge
jmk83
FREEOP

13 days ago

Service: hoerspiel-ffmpeg-renderer (Trial project)

Domain: hoerspiel-ffmpeg-renderer-production.up.railway.app

Issue description:

All requests to the public domain — including /, /health, and /version —

return HTTP 401 with body {"error":"Unauthorized"}. This response comes

directly from the edge (Server header: railway-hikari), before my

application code is ever reached.

This is confirmed because:

  • My Express app does not return this JSON format anywhere in its code
  • /health should return 200 "ok" per my own implementation
  • / should return 404 per my own implementation (no root route defined)
  • Neither of these expected responses occur — only the 401 JSON from the edge

What I've already checked and ruled out:

  • Public Networking is enabled, domain is generated and correctly mapped

    to port 8080

  • Under Attack Mode is confirmed OFF in Settings > Networking > Edge

  • Redeployed the service after confirming environment variables

    (AUTH_TOKEN / SERVICE_TOKEN) are correctly set — issue persists

    identically after redeploy

  • Trial plan status is active with 6 days and $3.94 credits remaining,

    so this does not appear to be a billing/trial expiration issue

  • Deleted and regenerated the public domain — issue persists

Error messages:

HTTP 401

{"error":"Unauthorized"}

Server: railway-hikari

What I need:

Please check whether there is an edge-level protection or access

restriction on this service that isn't visible/toggleable from the

standard Settings UI, and help me get the public domain to serve

requests directly to my application.

Link to repo: https://github.com/JMK83/hoerspiel-ffmpeg-renderer

$10 Bounty

6 Replies

Railway
BOT

13 days ago

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

Status changed to Open Railway 13 days ago


The repository is currently private.

I'd also check the middlewares you're using (if any).


It's most likely a library in your app that's returning this response (an auth library maybe). Railway's edge simply passes the response and status it receives from your app, so it most likely isn't the issue here.


jmk83
FREEOP

13 days ago

I’ve reviewed the current publication settings and middleware configuration.

Repository / App visibility

  • App is publicly deployed: effective_publish_visibility: public
  • URL: https://audio-script-suite.lovable.app
  • “Repository is private” appears to refer to the source repository visibility within Lovable. This should not affect the Railway renderer unless the project is connected to GitHub and exposed there.

Relevant middleware (src/start.ts)

  • errorMiddleware: handles server-side errors and renders HTTP 500 responses.
  • attachSupabaseAuth: attaches Supabase Bearer tokens to createServerFn RPC calls.
  • requireSupabaseAuth: protects specific server functions (Works, Episodes, Audio, Timeline, SFX, etc.).

Railway 401 diagnosis

These middlewares do not intercept or block the external fetch() request from the app to Railway. attachSupabaseAuth only applies to serverFn calls.

Therefore, the 401 Unauthorized is most likely being generated by Railway App/Deployment Protection, not by the application code.

Required Railway configuration

Please verify/disable:

Railway → Settings → Networking/Security → App/Deployment Protection

The following endpoints must be publicly accessible:

  • /health
  • /version
  • Render endpoint

Repository privacy and the current application middleware configuration do not appear to be the cause of the 401.


jmk83

I’ve reviewed the current publication settings and middleware configuration. Repository / App visibility * App is publicly deployed: effective_publish_visibility: public * URL: https://audio-script-suite.lovable.app * “Repository is private” appears to refer to the source repository visibility within Lovable. This should not affect the Railway renderer unless the project is connected to GitHub and exposed there. Relevant middleware (src/start.ts) * errorMiddleware: handles server-side errors and renders HTTP 500 responses. * attachSupabaseAuth: attaches Supabase Bearer tokens to createServerFn RPC calls. * requireSupabaseAuth: protects specific server functions (Works, Episodes, Audio, Timeline, SFX, etc.). Railway 401 diagnosis These middlewares do not intercept or block the external fetch() request from the app to Railway. attachSupabaseAuth only applies to serverFn calls. Therefore, the 401 Unauthorized is most likely being generated by Railway App/Deployment Protection, not by the application code. Required Railway configuration Please verify/disable: Railway → Settings → Networking/Security → App/Deployment Protection The following endpoints must be publicly accessible: * /health * /version * Render endpoint Repository privacy and the current application middleware configuration do not appear to be the cause of the 401.

Again, I'd test this locally and/or add logging every step of the way from when your application receives the request to responding to the request to help with the debug process.

Also, the reason I asked about repository visibility was so I could check the codebase.


Anonymous
FREETop 10% Contributor

13 days ago

Railway answers 502 when its edge cannot reach your app not 401.

The Server: railway-hikari header is stamped on every proxied response so it proves nothing.

Call the deployment over railway.internal from another service and check the 401 persists.


hussnain86
HOBBY

13 days ago

The consistent 401 {"error":"Unauthorized"} response from Server: railway-hikari is a strong indication that the request is being rejected at the Railway edge before it reaches the container.

A few details make this particularly notable:

  • /health is implemented to return 200 OK with ok, but never reaches the application.
  • / has no Express route and should therefore return the application's normal 404, but instead receives the identical edge-generated 401.
  • /version also receives the same 401.
  • Redeployment, regeneration of the public domain, environment-variable verification, and disabling Under Attack Mode did not change the behavior.
  • The trial is active, so billing/expiration does not appear to explain the response.

The most useful next step would be to check the edge configuration associated with this specific service/domain for any access-control policy, authentication middleware, private-network restriction, inherited protection rule, or trial-project restriction that may not be exposed in the normal Networking UI.

If possible, please also confirm whether Railway can see the incoming requests at the edge and whether they are being rejected before proxying to port 8080.

If the edge is intentionally returning this 401, identifying the exact policy/rule responsible should distinguish an application issue from a Railway edge configuration issue.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...