java - Serving static Resource with spring boot + spring security -


i work on angularjs application , try serve static resource (my front end) spring boot.

i used gulp build project , distribution structure: enter image description here

  • here content of hash folder

enter image description here

my spring security config this:

@override protected void configure(httpsecurity http) throws exception {     http             .exceptionhandling()             .authenticationentrypoint(myentrypoint());     http             .authorizerequests()             .antmatchers("/__hash__/**").permitall()              .antmatchers("/views/**").permitall()             .antmatchers("/index.html").permitall()             .antmatchers("/api/**").authenticated()             .antmatchers("/**").permitall();       http    // login configuration             .addfilterafter(springsecurityfilter(), basicauthenticationfilter.class);      /*http             .authorizerequests()             .anyrequest().authenticated();*/      http    //logout configuration             .logout()             .logoutsuccesshandler(logouthandler());      http.csrf().disable();  } 

the config spring serving static content:

@configuration public class mycontentconfig extends webmvcconfigureradapter {  @override public void addresourcehandlers(resourcehandlerregistry registry) {     registry             .addresourcehandler("/**")             .addresourcelocations("file:///" + "c:/front/") ; }  @override public void addviewcontrollers(viewcontrollerregistry registry) {     registry.addviewcontroller("/").setviewname("forward:/index.html"); }  } 

after authentication, index.html page without css style , without js.

enter image description here

and when try access css using url "https://localhost:9999/hash/styles.min.css" error:

 there unexpected error (type=not acceptable, status=406).  not find acceptable representation 

you loading livereload.js on http. if using https, resource must load on https. load livereload.js on https.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -