A developer builds a React SPA with client-side routing. After deploying to Nginx, refreshing the page at '/dashboard/reports' returns a 404. What server-side configuration resolves this?
- A.Set the Nginx location block to 'return 301 /' so that every refresh is sent to the home page, where React Router restores the route
- B.Add a 'proxy_pass' directive to the server block so that all paths are forwarded to a Node process, where the route is resolved by the server
- C.Configure Nginx with 'try_files $uri $uri/ /index.html' so that all requests that don't match a static file fall through to index.html, where React Router handles client-side routing
- D.Enable gzip on the static folder so that all browsers cache the bundle, since the 404 appears when the compressed file is missing
Why C is correct