Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try_files functionality like nginx #900

Closed
SidneyLann opened this issue Mar 15, 2019 · 3 comments
Closed

try_files functionality like nginx #900

SidneyLann opened this issue Mar 15, 2019 · 3 comments

Comments

@SidneyLann
Copy link

try_files functionality like it in nginx to support react

@spencergibb
Copy link
Member

A single sentence about a feature in some other server I don't know about isn't helpful. Please describe in detail the feature you're twisting l requesting.

@SidneyLann
Copy link
Author

in react, access index page, like http://localhost/index.html, when click the menu and rout to another page like /mgt/supplierList, if I click the fresh button of the browser, 404 exists because the server side has no /mgt/supplierList, however, nginx has the try_files directive to solve this problem like below:
location / {
root /home/sidney/html;
index index.html;
try_files $uri /index.html;
}

if the uri not exists in server side, so redirect to /index.html

@SidneyLann
Copy link
Author

spring.cloud.gateway.routes[13].id=index2
spring.cloud.gateway.routes[13].uri=forward:///mgt/index.html
spring.cloud.gateway.routes[13].predicates[0]=Path=/mgt

these lines do the thing for try_files, no need to implement now, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants