title: Spring Boot not returning correct MIME type
body: <p>I'm trying to make a Spring MVC app with Spring boot, Spring Security and Thymeleaf.</p>
  
  <p>The problem is - when i'm requesting a page with it's html and css, i'm not getting the correct MIME type for my css file, thus why Chrome cannot load it with status "<strong>canceled</strong>" and the message "<strong>Refused to apply style from '<a href="http://localhost:8080/login" rel="noreferrer">http://localhost:8080/login</a>' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.</strong>"</p>
  
  <p>I'm linking the css file correctly: 
  " "</p>
  
  <p>The css file is contained in:</p>
  
  <p>resources -> static -> css - > style.css</p>
  
  <p>I've allowed all resouces from the resources folder in the Security config file:</p>
  
  <pre><code>    package org.isp.configuration;
  
  import org.isp.services.api.UserService;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.http.MediaType;
  import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
  import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
  import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
  import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
  import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
  
  @Configuration
  @EnableWebSecurity
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Autowired
      private UserService userService;
  
      @Override
      protected void configure(AuthenticationManagerBuilder auth)
              throws Exception {
          auth.authenticationProvider(authenticationProvider());
      }
  
      @Bean
      public DaoAuthenticationProvider authenticationProvider() {
          DaoAuthenticationProvider authProvider
                  = new DaoAuthenticationProvider();
          authProvider.setUserDetailsService(this.userService);
          authProvider.setPasswordEncoder(getBCryptPasswordEncoder());
          return authProvider;
      }
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          String[] permitted = new String[]{
                  "/", "/home","/register","/about","/png/**",
                  "/css/**","/icons/**","/img/**","/js/**","/layer/**"
          };
  
          http
                  .authorizeRequests()
                  .antMatchers(permitted).permitAll()
                  .anyRequest().authenticated()
                  .and()
                  .formLogin().loginPage("/login").permitAll()
                  .defaultSuccessUrl("/dashboard")
                  .usernameParameter("username")
                  .passwordParameter("password")
                  .and()
                  .logout().logoutSuccessUrl("/login?logout").permitAll()
                  .and()
                  .exceptionHandling().accessDeniedPage("/unauthorized")
                  .and()
                  .csrf().disable();
      }
  
      @Bean
      public BCryptPasswordEncoder getBCryptPasswordEncoder(){
          return new BCryptPasswordEncoder();
      }
  }
  </code></pre>
  
  <p>This is my html page:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
      &lt;html lang="en" xmlns="http://www.w3.org/1999/xhtml" 
           xmlns:th="http://www.thymeleaf.org" &gt;
      &lt;head&gt;
          &lt;title&gt;Index&lt;/title&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
          &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
          **&lt;link rel="stylesheet" href="../static/css/style.css" type="text/css"&gt;**
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div th:include="~{fragments/navbar :: navbar}"&gt;&lt;/div&gt;
  
          &lt;div class="container"&gt;
              &lt;h3&gt;Home&lt;/h3&gt;
              &lt;p&gt;This is the home page of the project!&lt;/p&gt;
          &lt;/div&gt;
  
          &lt;div th:include="~{fragments/footer :: footer}" class="footer"&gt;&lt;/div&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>Any ideas how can i fix the incorrect MIME type? Is there any configuration im missing?</p>