Click here to Skip to main content
15,942,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created an angular application that displays a page with “Hello World” on ‘/hello’ route.
URL for angular: http://localhost:4200/hello
When I make request from browser to nginx on ‘/greet’: http://localhost/greet
that should be redirected to /hello route of angular application so that the page with “Hello World” is displayed.
But if the request is http://localhost/hello , an err should appear

The nginx conf:
server {
listen 80;
server_name _;
location /greet {
proxy_pass http://localhost:4200/hello;
}
location /hello {
return 404;
}
}

The issue is that while redirecting, the route is not getting modified as ‘/hello’
And since there is no ‘/greet’ route in angular, we get a not found.

What I have tried:

I have tried to make it work by adding a second '/' after '/greet' and also at the end of http://localhost:4200/hello, but still did not work
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900