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
source to share
No one has answered this question yet
Check out similar questions: