Nginx rewrite rules for AngularJS and html5mode activated

So far I am building an AngularJS app served by nginx. I had rails in the middle and came with rewrite ^/(?!assets) / last;

rewrite rules (rewrite everything, expect ones that start with assets) while it worked - with rails:

   server {
      listen 80;
      server_name ies.local;
      root /home/jk/Projects/ies12/webapp/public;   # <--- be sure to point to 'public'!
      passenger_enabled on;
      rails_env development;
      rewrite ^/(?!assets) / last;
    }

      

But today I left the rails and I need to expand this rule.

If I am something like

server {
  listen 80;
  server_name webapp.local;
  root /home/jk/Projects/webapp;
  rewrite_log on;

  rewrite ^/(?!angular) / last;
  rewrite ^/(?!angular-ui) / last;
}

      

having only webapp / index.html file and getting:

*1 rewrite or internal redirection cycle while internally redirecting to 
"/index.html", client: 127.0.0.1, server: webapp.local, request: "GET / HTTP/1.1", host: "webapp.local"

      

+3
angularjs url-rewriting nginx rewrite routing


source to share


No one has answered this question yet

Check out similar questions:

4523
Thinking in AngularJS if I have a jQuery background?
3178
AngularJS: Service vs provider vs factory
1690
How does data binding work in AngularJS?
1195
How do I access the $ scope variable in the browser console using AngularJS?
954
Node.js + Nginx - Now What?
912
'this' vs $ scope in AngularJS controllers
111
How to configure IIS for URL Rewriting AngularJS app in HTML5 mode?
4
Internal server error nginx 500
1
nginx rewrite the 404 throw with the latter and break
0
Nginx NodeJS proxying + AngularJS index.html rewriting



All Articles
Loading...
X
Show
Funny
Dev
Pics