Basic Auth Nginx Reverse Proxy for Railway.app's Servcie

This is for web application running in railway.app which need a basic auth without modifing source code.

You can add to railway easily by this button.

Deploy on Railway

Usage

Step 1

Fork this reop, and deploy it in the same project wihch the service you want to add basic auth.

Step 2

Modify deployed service's enviroment variable.

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.

Example: http://app-name.up.railway.app:3000

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.

References

  1. Simple HTML App with NGNIX Docker container doesn't run on Railway.app - Application failed to respond (error-503)
  2. OpenSSL コマンドでサーバー上で直接 .htpasswd に ID & パスワードを追加する
  3. Workaround for Alpine-based images