This is for web applications running in railway.app which need a basic auth without modifing source code.
You can add to railway easily by this button.
Fork this repo, and deploy it in the same project which the services you want to add basic auth.
Modify deployed service's enviroment variable. You should know that private network in railway is based on IPV6. So make sure your upstream applications have listened on an IPV6 port.
ENABLE_ALPINE_PRIVATE_NETWORKING
Most important one. You need this for alpine image's network.
Just set it to ENABLE_ALPINE_PRIVATE_NETWORKING=true
.
PROXY_PASS
The service's private network you want to be proxied. Now supports multiple values separated by commas.
Example: http://app-name.up.railway.app:3000,http://another-app-name.up.railway.app:3000
SERVER_NAME
The server name you want to use. Now supports multiple values separated by commas.
Example: server1.yourdomain.com,server2.yourdomain.com
PORT
The port expose to public. Default is 80
.
But someone said it's necessary for Railway.app
detecting which port for nging.
USERNAME
Username for auth. Default is user
.
PASSWORD
Password for auth. Default is password
.