Files
popiart-server/web/LOCAL_DOMAIN.md
T

44 lines
1.0 KiB
Markdown

# Local Subdomain Preview
Use a local subdomain-style URL instead of `127.0.0.1:3000`.
## Recommended URL
Modern browsers resolve `*.localhost` to the local machine automatically, so no `/etc/hosts` change is required.
- `http://popiart.localhost:3100/zh`
- `http://popiart.localhost:3100/en`
- `http://popiart.localhost:3100/zh/console`
- `http://popiart.localhost:3100/zh/skills`
## Run
Development server:
```bash
npm run dev:subdomain
```
Production preview:
```bash
npm run build
npm run start:subdomain
```
## Why this works
- The URL looks like a domain instead of `127.0.0.1`.
- It avoids port `3000` and uses `3100`.
- Session cookies stay same-origin because the app uses relative `/api/*` routes.
## If you need a real custom domain later
If you want a domain like `console.popi.art` locally, the next step is:
1. Add a hosts mapping to `127.0.0.1`.
2. Run a reverse proxy on port `80` or `443`.
3. Point that domain to the Next.js app.
That is a separate setup from the zero-config `*.localhost` approach.