Public proxy unreachable for Postgres database, DB is online but proxy drops all connections
kapiushon8
HOBBYOP

a month ago

My Postgres database is running and healthy (deploy logs confirm "database system is ready to accept connections" after recovery), but the public proxy is completely unreachable from external connections.

Error:

connection to server failed: server closed the connection unexpectedly
This probably means the server terminated abnormally before or while processing the request.

What I've tried:

  • Restarted the database multiple times — it recovers successfully each time
  • The database dashboard can query the DB internally (I see pg_stat_statements queries in the logs)
  • External connections via the public proxy URL all fail immediately
  • Other databases in the same project work fine

Details:

  • Project ID: 973ebc31-6f80-4831-8744-4aa78457bd9d
  • Postgres 17.6
  • Proxy host: ballast.proxy.rlwy.net

I need to dump/migrate data from this database urgently. Could you help fix the proxy or assist with extracting a pg_dump?

Solved$10 Bounty

Pinned Solution

I have created Postgres Backup API template that you can use to backup your database using your internal database URL.

1. Click on the Add button in your dashboard canvas to add a new template to your project.

2. Search for the template name and scroll down to find it:

3. Set your DATABASE_URL env variable.

4. Just navigate to the service URL in your browser, and it will download a backup file to your machine.

7 Replies

Status changed to Awaiting Railway Response Railway about 2 months ago


Status changed to Open Railway about 1 month ago


kapiushon8
HOBBYOP

a month ago

bump^


Try deleting your TCP proxy and generate a new one. Go to your service Settings > Networking and regenerate it from there.


darseen

Try deleting your TCP proxy and generate a new one. Go to your service **Settings > Networking** and regenerate it from there.

kapiushon8
HOBBYOP

a month ago

Update: Regenerated the TCP proxy however the new proxy (mainline.proxy.rlwy.net:18453) also fails with the same "server closed the connection unexpectedly" error.

This confirms the issue is not proxy-specific. The DB logs show successful startup and "ready to accept connections" but no external connection succeeds.


kapiushon8
HOBBYOP

a month ago

tried them all, none worked:

  • SSL mode: psql "url?sslmode=require" — same "server closed the connection unexpectedly" error
  • Regenerated TCP proxy 3 times: ballast, mainline, and crossover proxy hosts all fail identically
  • Internal pg_dump via another service: Railway CLI won't let me create a new service in the project to run it
  • DB restart: Done multiple times, logs show successful recovery and "ready to accept connections" every time

This isn't a plugin-based DB so detach/re-attach doesn't apply. Also tried restarting the entire project.


I have created Postgres Backup API template that you can use to backup your database using your internal database URL.

1. Click on the Add button in your dashboard canvas to add a new template to your project.

2. Search for the template name and scroll down to find it:

3. Set your DATABASE_URL env variable.

4. Just navigate to the service URL in your browser, and it will download a backup file to your machine.


darseen

I have created [Postgres Backup API](https://railway.com/deploy/postgres-backup-api) template that you can use to backup your database using your internal database URL. 1\. Click on the **Add** button in your dashboard canvas to add a new template to your project. 2\. Search for the template name and scroll down to find it: ![](https://station-server.railway.com/attachments/att_01knt96g28e058k156apm3vv72) 3\. Set your `DATABASE_URL` env variable. ![](https://station-server.railway.com/attachments/att_01knt94r3je8p9t77sbg70ydz9) 4\. Just navigate to the service URL in your browser, and it will download a backup file to your machine.

kapiushon8
HOBBYOP

a month ago

Got it, thanks so much for your help man!


kapiushon8

Got it, thanks so much for your help man!

You're welcome!


Status changed to Solved chandrika about 1 month ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...