Support flexible base paths and thin proxies
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# AI Share Thin Proxy
|
||||
|
||||
This compose stack runs only nginx and forwards an external hostname/path to an existing AI Share origin. It is intended for small servers where the browser-facing URL may be different from the origin URL.
|
||||
|
||||
The origin service should keep a stable internal mount, usually:
|
||||
|
||||
```env
|
||||
AISHARE_BASE_PATH=/aishare
|
||||
```
|
||||
|
||||
The proxy can expose that same origin as any hostname/path because reader pages use relative links and the admin UI derives API/share URLs from the browser's current URL.
|
||||
|
||||
## Prefix Proxy
|
||||
|
||||
Example: expose `https://domain.com/services/aishare/` and forward to an origin mounted at `/aishare`.
|
||||
|
||||
```bash
|
||||
cd proxy
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
```env
|
||||
AISHARE_PROXY_BIND=127.0.0.1:8090
|
||||
AISHARE_PROXY_SERVER_NAME=domain.com
|
||||
AISHARE_PROXY_EXTERNAL_PATH=/services/aishare
|
||||
AISHARE_UPSTREAM_ORIGIN=https://origin.example.com
|
||||
AISHARE_UPSTREAM_PATH=/aishare
|
||||
```
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Point the server's edge nginx at `http://127.0.0.1:8090`.
|
||||
|
||||
## Root Host Proxy
|
||||
|
||||
Example: expose `https://aishare.domain.com/` and forward to an origin mounted at `/aishare`.
|
||||
|
||||
```env
|
||||
AISHARE_PROXY_BIND=127.0.0.1:8090
|
||||
AISHARE_PROXY_SERVER_NAME=aishare.domain.com
|
||||
AISHARE_PROXY_EXTERNAL_PATH=/
|
||||
AISHARE_UPSTREAM_ORIGIN=https://origin.example.com
|
||||
AISHARE_UPSTREAM_PATH=/aishare
|
||||
```
|
||||
|
||||
## Direct Serving
|
||||
|
||||
If this service is not behind a rewriting proxy, set the app mount directly:
|
||||
|
||||
```env
|
||||
AISHARE_BASE_PATH=/
|
||||
```
|
||||
|
||||
or:
|
||||
|
||||
```env
|
||||
AISHARE_BASE_PATH=/services/aishare
|
||||
```
|
||||
|
||||
Then route traffic to the AI Share container without path rewriting.
|
||||
Reference in New Issue
Block a user