Skip to content

Commit 15b996d

Browse files
authored
Issue LIF-Initiative#880: Add SPA fallback nginx config to Advisor frontend (LIF-Initiative#881)
##### Description of Change Adds an `nginx.conf` with `try_files` SPA fallback routing to the Advisor frontend, matching the existing MDR frontend pattern. **What problem does this solve?** When a user enters a wrong password, the app navigates to `/login`. Without SPA fallback routing, nginx returns a 404 page instead of serving the React app. The user sees a blank "404 Not Found" page and must manually navigate back. **What is the solution?** - Add `nginx.conf` with `try_files $uri /index.html;` (same as `frontends/mdr-frontend/nginx.conf`) - Uncomment and update the `COPY` line in the Dockerfile to install the config **How should reviewers test this?** - Build and run the Advisor Docker image - Enter wrong credentials on the login page - Verify the error message appears and the login form stays visible (instead of a 404) ##### Related Issues Closes LIF-Initiative#880 ##### Type of Change - [x] Bug fix (non-breaking change which fixes an issue) ##### Project Area(s) Affected - [x] frontends/ --- ##### Checklist - [x] commit message follows commit guidelines (see commitlint.config.mjs) ##### Testing - [ ] Manual testing performed - [ ] Automated tests added/updated - [ ] Integration testing completed 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents c2c58d4 + a3a8891 commit 15b996d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

frontends/lif_advisor_app/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ FROM nginx:1.26-alpine AS serve
2828
# Copy built files from the previous stage
2929
COPY --from=build /app/dist /usr/share/nginx/html/
3030

31-
# Optionally: copy custom nginx config - for SPA, you'll need this, similar to mdr-frontend
32-
# COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
31+
# Copy custom nginx config for SPA fallback routing
32+
COPY nginx.conf /etc/nginx/conf.d/default.conf
3333

3434
# Expose default Nginx port
3535
EXPOSE 80
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
server {
2+
listen 80;
3+
4+
root /usr/share/nginx/html;
5+
index index.html;
6+
7+
location / {
8+
try_files $uri /index.html;
9+
}
10+
}

0 commit comments

Comments
 (0)