Deploy Nginx proxy
Deploy and Host bearer-proxy with Railway
bearer-proxy
Just deployed
Deploy and Host bearer-proxy on Railway
bearer-proxy is a lightweight nginx reverse proxy that protects any HTTP service behind Bearer token authentication. Drop it in front of any internal service to add secure, token-based access control without modifying the service itself.
About Hosting bearer-proxy
Hosting bearer-proxy involves running an nginx container that sits between your clients and an upstream service. On startup, it dynamically detects the DNS resolver (critical for Railway's internal networking), generates the nginx config from environment variables, and begins proxying requests. Only requests with a valid Authorization: Bearer header are forwarded to the upstream. All others receive a 401. The container is stateless and requires no persistent storage.
Common Use Cases
- Protect internal Railway services — expose services like Prometheus, internal APIs, or admin tools to the internet with token authentication
- Secure microservice communication — add an auth layer in front of services that don't natively support authentication
- API gateway for private tools — gate access to internal dashboards or services without modifying their code
Dependencies for bearer-proxy Hosting
- A running upstream HTTP service to proxy to (the
ORIGIN) - A securely generated Bearer token (
BEARER_TOKEN)
Deployment Dependencies
- nginx:alpine — base image
- gettext — provides
envsubstfor config templating
Implementation Details
Set these environment variables before deploying:
BEARER_TOKEN=your_secret_token_here
ORIGIN=http://your-service.railway.internal:PORT
Then call your proxied service with:
curl https://your-proxy.railway.app/your-endpoint \
-H "Authorization: Bearer your_secret_token_here"
Why Deploy bearer-proxy on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying bearer-proxy on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
bearer-proxy
usesendly/bearer-proxyORIGIN
Upstream service URL to proxy requests to (e.g. http://service.railway.internal:8888)
