Intermittent 502 errors
geraintf
PROOP

7 months ago

I have a node server that I've had running on railways for well over a year with no issues. I don't have a huge amount of traffic but today, 2 separate times my frontend got a 502 response and a message of "Application failed to respond". IIUC this means the request made it to the railway infra but was unable to proxy this to my application, confirmed by the fact I couldn't see this request in my server logs.

Interestingly, I had the same client make 4/5 api calls around the same time (within a few 100ms) and only one failed but the server must've been up and healthy to serve 200s to the other api calls.

Is it possible to see any logging for these 502 errors? Is it normal for occasional requests to get 502's?

Solved

15 Replies

Railway
BOT

7 months 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!


saarimz
PRO

7 months ago

i have been having these issues over the past 24 hours too and have not received a single word from support



Railway
BOT

7 months ago

Hello!

We've escalated your issue to our engineering team.

We aim to provide an update within 1 business day.

Please reply to this thread if you have any questions!

Status changed to Awaiting User Response Railway 7 months ago


brody
EMPLOYEE

7 months ago

Hello,

We've added enhanced logging on our side and are actively working to make that information available to you in the HTTP logs.

We're not seeing elevated 502 rates across the platform, which suggests this may be related to your specific application configuration.

In the meantime, please let us know when you encounter a 502 status code so we can check the logs and help you identify what's causing the issue.

Best,

Brody


brody

Hello,We've added enhanced logging on our side and are actively working to make that information available to you in the HTTP logs.We're not seeing elevated 502 rates across the platform, which suggests this may be related to your specific application configuration.In the meantime, please let us know when you encounter a 502 status code so we can check the logs and help you identify what's causing the issue.Best,Brody

geraintf
PROOP

7 months ago

Thanks Brody, looking forward to having access to those logs.

An example from yesterday that you might be able to check. I got a 502 @ Jul 16, 2025 - 12:56:37.249 AM (UTC) which did not appear in my server logs but was recorded by my FE


Status changed to Awaiting Railway Response Railway 7 months ago


brody
EMPLOYEE

7 months ago

We would need a request ID to be able to lookup the error on our side, that would be returned in a X-Railway-Request-Id header.


Status changed to Awaiting User Response Railway 7 months ago


rjbathgate
PRO

7 months ago

Note sure if relevant at all, so apologies if not, but worth mentioning...

We recently had elevated 502s as well (as soon as we migrated to Railway from AWS).

We discovered that the Apache KeepAliveTimeout on our end was 5 seconds, but at Railway, it's currently 15 seconds.

As a result, say then a subsequent request may come in after 7 seconds, Railway thinks the connection is still alive (within 15 seconds), Apache at our has end dropped it. This can result in a 502.

We adjusted our apache config to set the KeepAliveTimeout to 15 seconds (or 16, for a small buffer) and it seems to have helped (still monitoring).

Railway mentioned they might look at changing their 15 seconds to 5seconds to provide more better compatibility with most HTTP servers


Status changed to Awaiting Railway Response Railway 7 months ago


Yep, exactly it. We're evaluating this change to see if that will resolve a lot of 502s that people were facing.


Status changed to Awaiting User Response Railway 7 months ago


Railway
BOT

6 months ago

✅ The ticket Temporary Service Disruptions has been marked as completed.


geraintf
PROOP

6 months ago

Hi,

Apologies for the delay, I needed to update some tooling in order to extract the request ids.

We are still seeing 502s with the requests not reaching our server. We been investigating further from our side but we have not been able to identify anything. As far as we can tell the server is healthy and accepting requests. It's a pretty simple setup, just a node server in a docker container.

Here are some request IDs where a 502: Application failed to respond error was returned.

Aug 14, 2025 - 04:51:26.153 AM (UTC) - fnsvqGLPReOnEEJ-xtoGcA

Aug 12, 2025 - 09:40:28.209 PM (UTC) - P_Wx6MlQSHGS5tIunjUZ_Q

Aug 10, 2025 - 03:21:35.060 AM (UTC) - Dq9-R_BrSMGiTcCnz8YAag

Thanks!


Status changed to Awaiting Railway Response Railway 6 months ago


brody
EMPLOYEE

6 months ago

Hello,

We have now made the errors our proxy experienced while communicating with your application available in your HTTP logs.

You can filter for 502 status codes with @httpStatus:502, and then click the log to see the error details in the upstreamErrors attribute.

From the last 502: connection closed unexpectedly

Some users have solved this by increasing their keepalive timeout within their application to 15 minutes, or adding another replica as we will retry with another replica if available.

Best,
Brody


Status changed to Awaiting User Response Railway 6 months ago


geraintf
PROOP

6 months ago

Thanks for the update Brody.

Do I need to do anything to enable searching with @httpStatus? Like add structured logs?

It looks like right now I'm not able to see/use any of the http filters. It looks like the only one available to me is '@level'


Status changed to Awaiting Railway Response Railway 6 months ago


brody
EMPLOYEE

6 months ago

Please make sure you open the HTTP Logs tab within a specific deployment. The global Logs tab will not have what you are looking for.


Status changed to Awaiting User Response Railway 6 months ago


geraintf
PROOP

6 months ago

Wow! I've been using railway for just over 2 years and didn't even know this logs view existed! I've just been using the 'Observability' page.

Confirming I can see the 502s on those logs and an upstream error of connection closed unexpectedly so I will look into adjusting our keepalive timeout.

Thanks for the help Brody, enjoy the rest of your week!


Status changed to Awaiting Railway Response Railway 6 months ago


brody
EMPLOYEE

6 months ago

You as well, let me us know if you see any improvements by increasing the keepalive or by adding replicas.


Status changed to Awaiting User Response Railway 6 months ago


Railway
BOT

6 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 6 months ago


Loading...