File tree Expand file tree Collapse file tree 5 files changed +54
-0
lines changed
nextjs/etc/nginx/templates
storybook/etc/nginx/templates Expand file tree Collapse file tree 5 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,15 @@ FROM base AS proxy
3535
3636COPY /proxy /
3737
38+ # #
39+ # Vite
40+ # #
41+ FROM proxy AS vite
42+
43+ COPY /vite /
44+
45+ ENV NGINX_PROXY_PASS=http://app:5173
46+
3847# #
3948# NextJS
4049# #
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ environment:
7171This nginx proxy comes with three predefined configurations :
7272
7373- Proxy
74+ - Vite
7475- Next.js
7576- Storybook
7677- Drupal
@@ -95,6 +96,26 @@ environment:
9596 NGINX_PROXY_PASS: <no default>
9697` ` `
9798
99+ # ## Vite
100+
101+ Vite is like the proxy configuration but also forwards all WebSocket
102+ requests.
103+
104+ ` ` ` yaml
105+ image: ghcr.io/reload/https-proxy:vite
106+ ` ` `
107+
108+ See the configuration details in
109+ [`context/vite/etc/nginx/templates/default.conf.template`](context/nextjs/etc/vite/templates/default.conf.template).
110+
111+ Use can use the following configuration in your `docker-compose.yml` :
112+
113+ ` ` ` yaml
114+ environment:
115+ NGINX_DOCUMENT_ROOT: /var/www/web
116+ NGINX_PROXY_PASS: http://app:5173
117+ ` ` `
118+
98119# ## Next.js
99120
100121Next.js is like the proxy configuration but also forwards WebSocket
Original file line number Diff line number Diff line change 66
77 location / {
88 proxy_pass ${NGINX_PROXY_PASS};
9+ proxy_set_header Host $host;
10+ proxy_set_header X-Real-IP $remote_addr;
11+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
912 }
1013
1114 location /_next/webpack-hmr {
Original file line number Diff line number Diff line change 66
77 location / {
88 proxy_pass ${NGINX_PROXY_PASS};
9+ proxy_set_header Host $host;
10+ proxy_set_header X-Real-IP $remote_addr;
11+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
912 }
1013
1114 location /__webpack-hmr {
Original file line number Diff line number Diff line change 1+ server {
2+
3+ include include.d/ssl.conf;
4+
5+ root ${NGINX_DOCUMENT_ROOT};
6+
7+ location / {
8+ proxy_pass ${NGINX_PROXY_PASS};
9+ proxy_set_header Host $host;
10+ proxy_set_header X-Real-IP $remote_addr;
11+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
12+
13+ # WebSocket proxy
14+ proxy_set_header Upgrade $http_upgrade;
15+ proxy_set_header Connection "Upgrade";
16+ proxy_read_timeout 86400;
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments