feat(frontend): add nginx config for SPA routing
- Added a RUN command in Dockerfile.frontend to generate an nginx configuration that enables single-page application routing by serving index.html for unmatched URIs, ensuring proper client-side navigation.
lemon-mint committed
Nov 1, 2025 at 02:38 UTC
dde6e4876e29c3b214186e61e2a7389e58cf44e6
1 file changed
+12
Dockerfile.frontend
+12
@@ -17,6 +17,18 @@ COPY --from=builder /src/cmd/webclient/service-worker.js /usr/share/nginx/html/s
17
COPY --from=builder /src/cmd/webclient/wasm_exec.js /usr/share/nginx/html/wasm_exec.js
18
COPY --from=builder /src/bin/main.wasm /usr/share/nginx/html/main.wasm
19
20
+# Create nginx config for SPA routing
21
+RUN echo 'server { \
22
+ listen 80; \
23
+ server_name localhost; \
24
+ root /usr/share/nginx/html; \
25
+ index index.html; \
26
+ \
27
+ location / { \
28
+ try_files $uri $uri/ /index.html; \
29
+ } \
30
+}' > /etc/nginx/conf.d/default.conf
31
+
32
EXPOSE 80
33
34
CMD ["nginx", "-g", "daemon off;"]