Issue in proxy pass from nginx to angular application

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.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer