Debasish Das Gupta
Debasish Das Gupta

Reputation: 109

SPA is not working in online hositng

I recently published my SPA to the free account of hostinger.in. In localhost the application works fine. But in online account it not loading views and producing errors in console mentioned bellow.

"XMLHttpRequest cannot load http://error.hostinger.eu/?. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mdm.890m.com' is therefore not allowed access."

PLese help me to solve the issue!

Upvotes: 1

Views: 351

Answers (1)

kaspur
kaspur

Reputation: 36

The relative path in your templateUrls are wrong in app.js Please remove the "mdm" directory from your template urls. So templateUrl: '/mdm/html/fundtype.html' becomes templateUrl: '/html/fundtype.html'

Also the error output is misleading in this case, as your host does a 302 redirect to a 404 page on a different host, causing the CORS error. This is not a CORS problem because your initial request is for the same host.

Upvotes: 2

Related Questions