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:
- here content of hash folder
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.
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
Post a Comment