0

I have my NodeJS application running on port 11000 and AngularJS running on port 9000.

I am using HTML5 mode true in AngularJS and my URL's with #! and redirected to / using this mode. However, when I hit refresh, it gives 404.

I do have in my index.html.

As per the link: Angular ui-router pressing refresh causes 404 error. Before pressing the reload/refresh, the url works fine without the hashbang. When I manually add /#!/, it gets redirected to the right path.

The problem needs to be handled server side using app.use(*, callback) but since the server is running on port 11000, the request never really reaches there. Am I missing out on something fundamental here? I tried putting in the star wildcard for all routes in node js but that didn't help.

br.julien
  • 3,420
  • 2
  • 23
  • 44
systemdebt
  • 4,589
  • 10
  • 55
  • 116

1 Answers1

1

Actually you are running two separate application one is on node server and another is on local 'grunt-dev server'. So in single page application routing is handled on client side js but when you refresh for a route then initially there is no js loaded to handle the routing and it makes a get request for the same to the server but there is no handling for the same so it gives 404. You have to do config in the grunt-file for handling the such routes.

Arun Redhu
  • 1,584
  • 12
  • 16