title: Favicon is not rendering correctly, looks garbled
body: <p>My favicon seems to be acting up all of a sudden. I'm not sure what change I made that caused it to start failing, but it used to render just fine and now it's garbled.</p>
  
  <p>Here's a sample of what it looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/7kqjA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7kqjA.png" alt="enter image description here"></a></p>
  
  <p>I'm using Spring Boot and have Googled around to find all the typical answers on how to get your favicon showing up... but I've had no luck.</p>
  
  <p>One thing I noticed (not sure if this is normal or not), is that when I visit the favicon URL, it doesn't load it in the browser as an icon, instead it loads as a bunch of text.</p>
  
  <p>Here's what happens when I visit my localhost:8080/favicon.ico url:</p>
  
  <p><a href="https://i.stack.imgur.com/sPFIA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sPFIA.png" alt="enter image description here"></a></p>
  
  <p>The only thing I can think of that I've changed recently that might have had an effect on the favicon was my WebSecurityConfig.java... I added a REALM and basic authentication.</p>
  
  <p>Here's the WebSecurityConfig.java file:</p>
  
  <pre><code>@Configuration
  @EnableWebSecurity
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter
  {
    @Autowired
    private UserDetailsService userDetailsService;
  
    private static String REALM="MY_TEST_REALM";
  
    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
  
    @Autowired
    public void globalSecurity (AuthenticationManagerBuilder auth) throws Exception
    {
      auth.userDetailsService(userDetailsService)
        .passwordEncoder(passwordEncoder());
    }
  
    @Override
    protected void configure(HttpSecurity http) throws Exception
    {
      // authenticate / authorize
      // authentication = who the hell are you? i.e. username/password
      // authorization = what can you access in the app?
  
      http
        .csrf().disable()
        .authorizeRequests()
          .antMatchers("/*").permitAll()
          .antMatchers("/js/**").permitAll()
          .antMatchers("/webinars/**").permitAll()
          .antMatchers("/img/**").permitAll()
          .antMatchers("/fonts/**").permitAll()
          .antMatchers("/register").permitAll()
          .antMatchers("/samcart").permitAll()
          .antMatchers("/sales").permitAll()
          .antMatchers("/sales/**").permitAll()
          .antMatchers("/paypal/**").permitAll()
          .antMatchers("/forgotPassword").permitAll()
          .antMatchers("proffesso-favicon.ico").permitAll()
          .antMatchers("/students/purchasedCourse.html").permitAll()
          .antMatchers("/students/courses/**").permitAll()
          .antMatchers("/teachers/courses/*/image").permitAll()
          .antMatchers("/teachers/courses/*/offers/*/image").permitAll()
          .antMatchers("/handlebars/**").permitAll()
          .antMatchers("/css/**").permitAll()
          .antMatchers("/admin/**").hasRole("ADMIN")
          .antMatchers("/admin").hasRole("ADMIN")
          .anyRequest().authenticated()
          .and()
        .httpBasic()
          .realmName(REALM)
          .authenticationEntryPoint(getBasicAuthEntryPoint())
          .and()
        .formLogin()
          .loginPage("/login")
          .defaultSuccessUrl("/students/courses")
          .successHandler(new NoRedirectSavedRequestAwareAuthenticationSuccessHandler())
          .permitAll()
          .and()
        .logout()
          .logoutSuccessUrl("/").permitAll()
          .and()
        .sessionManagement()
          .maximumSessions(1);
    }
  
    @Bean
    public CustomBasicAuthenticationEntryPoint getBasicAuthEntryPoint(){
        return new CustomBasicAuthenticationEntryPoint();
    }
  
    /* To allow Pre-flight [OPTIONS] request from browser */
    @Override
    public void configure(WebSecurity web) throws Exception {
        web.ignoring().antMatchers(HttpMethod.OPTIONS, "/**");
    }
  
    @Bean
    public HttpSessionEventPublisher httpSessionEventPublisher() {
        return new HttpSessionEventPublisher();
    }
  
    @Bean()
    public SecurityEvaluationContextExtension securityEvaluationContextExtension () {
      return new SecurityEvaluationContextExtension();
    }
  }
  </code></pre>