Skip to content

Commit

Permalink
Set proxy headers in Nginx example
Browse files Browse the repository at this point in the history
  • Loading branch information
mjnaderi committed Sep 10, 2023
1 parent 2af0438 commit 6e31cf8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ In production, use a reverse proxy like Nginx or Caddy:
| `/_next/...` | Proxy to `http://localhost:3000` |
| `/next/...` | Serve `NEXTJS_PATH/public/next` directory |

Pass `x-real-ip` header when proxying `/_next/`. Example config for Nginx:
Example config for Nginx:

```conf
location /_next/static/ {
Expand All @@ -115,8 +115,11 @@ location /_next/static/ {
add_header Cache-Control "public";
}
location /_next/ {
proxy_set_header x-real-ip $remote_addr;
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /next/ {
alias NEXTJS_PATH/public/next/;
Expand Down

0 comments on commit 6e31cf8

Please sign in to comment.