AngularJS Loads Index.html Instead Of Template

- 1 answer

I'm having troubles with an app when loaded on my deployment server.

I'm using AngularJS 1.4.x and following the scheme proposed by Angular-Seed template for routing and configuration:

Everything works fine on local (Apache) and on another remote web server (Apache) (a free hosting service). Routing works and pages load like expected. In the remote server i can experience some little hangs when loading a template not loaded before but i think it's normal.

The problem is on my official deployment server (Apache): Instead of loading routes templates it load recursively the index.html inside it self resulting in an stack exceeded error from the browser after few seconds and the halting of the page.

Sometimes it doesn't and load the page like expected, but after two or three routes it start loading index.html recursively instead of the template requested. In most cases, however, at the first route triggered by link or event the page hangs loading recursively index.html inside itself.

Like in angular-seed i have a single index.html with a <div ng-view></div> tag for content.

No problem on local and in the another free web server.

I've tried even to use ui.router and his states pattern instead of ng-router.

No more stack exceeded because after the first index.html loaded inside index.html at the <div ng-view> it stops the recursion.

With ui.router, still no problem in local or in the other free web server. The app do what expected loading all the states/route.

There is some apache configuration or something i must check on the server?

The deployment server is a dedicated server so i can have access to everything.

Thanks for help!


Here Apache modules of the three server:

Local server Apache modules: core http_core mod_access_compat mod_actions mod_alias mod_allowmethods mod_auth_basic mod_auth_digest mod_auth_form mod_authn_anon mod_authn_core mod_authn_dbd mod_authn_dbm mod_authn_file mod_authn_socache mod_authnz_ldap mod_authz_core mod_authz_dbd mod_authz_dbm mod_authz_groupfile mod_authz_host mod_authz_owner mod_authz_user mod_autoindex mod_bucketeer mod_buffer mod_cache mod_cache_disk mod_case_filter mod_case_filter_in mod_cern_meta mod_cgi mod_cgid mod_charset_lite mod_dav mod_dav_fs mod_dbd mod_deflate mod_dir mod_dumpio mod_echo mod_env mod_expires mod_ext_filter mod_file_cache mod_filter mod_headers mod_include mod_info mod_lbmethod_bybusyness mod_lbmethod_byrequests mod_lbmethod_bytraffic mod_lbmethod_heartbeat mod_log_config mod_log_debug mod_logio mod_mime mod_mime_magic mod_negotiation mod_perl mod_php5 mod_proxy mod_proxy_ajp mod_proxy_balancer mod_proxy_connect mod_proxy_express mod_proxy_fcgi mod_proxy_ftp mod_proxy_http mod_proxy_scgi mod_ratelimit mod_remoteip mod_reqtimeout mod_request mod_rewrite mod_sed mod_session mod_session_cookie mod_session_dbd mod_setenvif mod_slotmem_shm mod_so mod_socache_dbm mod_socache_memcache mod_socache_shmcb mod_speling mod_ssl mod_status mod_substitute mod_suexec mod_unique_id mod_unixd mod_userdir mod_usertrack mod_version mod_vhost_alias prefork util_ldap

Remote server Apache modules: core http_core mod_actions mod_alias mod_asis mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_av_htaccess mod_cgi mod_deflate mod_dir mod_env mod_expires mod_fastcgi mod_filter mod_include mod_log_config mod_logio mod_mime mod_negotiation mod_php5 mod_rewrite mod_setenvif mod_so mod_status mod_version mod_vhost_alias parser prefork

Production server Apache modules: core http_core mod_actions mod_alias mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_expires mod_filter mod_headers mod_include mod_log_config mod_logio mod_mime mod_negotiation mod_proxy mod_proxy_ajp mod_proxy_balancer mod_proxy_connect mod_proxy_ftp mod_proxy_http mod_proxy_scgi mod_rewrite mod_setenvif mod_so mod_ssl mod_status mod_suexec mod_unique_id mod_userdir prefork

Could be the lack of mod_vhost_alias be related to issue? I've read that mod_userdir will overwrite mod_vhost_alias but it's the only module missing in my production server that concern resolution of files and that is present on local and remote free configuration...

I'll try to rebuild apache and include that module in the next few days and then test.



After some checking by the support team of my hosting provider we have identified the problem.

It was related to some false positive matching by ModSecurity apache module.

I had to disable following rules id:


And this maybe not strictly related rule that got triggered during testing:


All rules are related to MySQL injection preventing.

Now app works as expected.

Hope it can be of anyhelp for someone.

Thank you all for support, tips and advices!