Home  >  Forum  >  Angular
Post New Query

Refused to execute script from 'http://localhost:8081/uaa/login' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.



Asked on May 09, 2018
Hello,

I am using spring boot micro service with angular application and using UAA as authorization server. If my session expires means in the console it is going to login page of authorization server which is login page of UAA but the browser is not redirecting to login page. I am getting following error in console :
Refused to execute script from 'http://localhost:8081/uaa/login' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Can any one provide solution in this?

Thanks & Regards
Shilpa Kulkarni



Replied on May 09, 2018
You need to allow cross-origin request. Use @CrossOrigin at server side controller and configure client domains. For example.  

@Controller
@CrossOrigin(origins = {"http://localhost:8081", "http://localhost:8088"})
public class MyController {

}



Replied on May 09, 2018
If your angular application is running at http://localhost:4200  Then use @CrossOrigin at the controller which is serving the authentication request at server side.

@Controller
@CrossOrigin(origins = {"http://localhost:4200"})
public class MyController {

}



Replied on May 14, 2018
Thank you. It worked.

Write Answer




©2019 concretepage.com | Privacy Policy | Contact Us