Skip to content

Commit 6a0ff13

Browse files
committed
Allow to configu
1 parent 6a206e5 commit 6a0ff13

5 files changed

Lines changed: 14 additions & 7 deletions

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
DOMAIN=local.example.com
2+
HTTP_PORT=8080
3+
HTTPS_PORT=8443
24
UPSTREAM_URL=http://host.docker.internal:3000

CLAUDE.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Environment variables (set in `.env`):
4040

4141
- `DOMAIN` - Domain name for SSL cert (default: `localhost`)
4242
- `UPSTREAM_URL` - URL for your local app (default: `http://host.docker.internal:3000`)
43+
- `HTTP_PORT` - HTTP port for redirects (default: `8080`)
44+
- `HTTPS_PORT` - HTTPS port for proxy (default: `8443`)
4345

4446
## Files
4547

@@ -51,5 +53,5 @@ Environment variables (set in `.env`):
5153

5254
## Ports
5355

54-
- `8080` → HTTP (redirects to HTTPS on 8443)
55-
- `8443` → HTTPS (proxies to `${UPSTREAM_URL}`)
56+
- `${HTTP_PORT}` (default `8080`) → HTTP (redirects to HTTPS)
57+
- `${HTTPS_PORT}` (default `8443`) → HTTPS (proxies to `${UPSTREAM_URL}`)

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,14 @@ Note (Linux): Requires Docker Engine 20.10+ for `host-gateway` support.
101101
| Variable | Default | Description |
102102
| -------------- | ---------------------------------- | ---------------------- |
103103
| `DOMAIN` | `localhost` | Domain for SSL cert |
104+
| `HTTP_PORT` | `8080` | HTTP port (redirects) |
105+
| `HTTPS_PORT` | `8443` | HTTPS port (proxy) |
104106
| `UPSTREAM_URL` | `http://host.docker.internal:3000` | URL for your local app |
105107

106108
## Ports
107109

108-
- `8080` - HTTP (redirects to HTTPS)
109-
- `8443` - HTTPS
110+
- `HTTP_PORT` (default `8080`) - HTTP (redirects to HTTPS)
111+
- `HTTPS_PORT` (default `8443`) - HTTPS
110112

111113
## Layout
112114

config/Caddyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
:80 {
2-
redir https://{$DOMAIN:localhost}:8443{uri} permanent
2+
redir https://{$DOMAIN:localhost}:{$HTTPS_PORT:8443}{uri} permanent
33
}
44

55
{$DOMAIN:localhost} {

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ services:
1717
dockerfile: Dockerfile.caddy
1818
container_name: ssl-proxy
1919
ports:
20-
- "8080:80"
21-
- "8443:443"
20+
- "${HTTP_PORT:-8080}:80"
21+
- "${HTTPS_PORT:-8443}:443"
2222
environment:
2323
- DOMAIN=${DOMAIN:-localhost}
2424
- UPSTREAM_URL=${UPSTREAM_URL:-http://host.docker.internal:3000}
25+
- HTTPS_PORT=${HTTPS_PORT:-8443}
2526
extra_hosts:
2627
- "host.docker.internal:host-gateway"
2728
volumes:

0 commit comments

Comments
 (0)