web ignoring을 설정해도 favicon.ico가 계속 302 redirect 됩니다.
2480
작성한 질문수 12
안녕하세요, 강의 잘 보고 있습니다.
다만 실전 프로젝트 중 WebIgnoring 을 강사님이 하신 것 처럼 똑같이 따라 했는데도 불구하고
계속 favicon.ico가 302 redirect 됩니다. (아직 로그인 인증을 받지 않은 상태에서 루트 경로로 접속 시)
인텔리제이도 재시작 해보고, 인텔리제이 메뉴에서 invalidate caches/restart도 봤으나 결과는 계속 localhost:9090/login 으로 302 redirect 입니다.
제가 따로 web.ignoring().antMatchers("/favicon.ico", "/**/favicon.ico");와 같이 코드를 추가했어도 계속 302 redirect가 발생되네요.
web.ignoring().antMatchers("/favicon.ico", "/**/favicon.ico"); [이 코드를 추가 하나 안 하나 변함 없이 302 redirect가 됩니다]
해결 방법이 있을까요?
감사합니다. (혹시 제가 이전에 올린 질문 글도 답변 부탁드려도 될까요...?)
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// memory 방식으로 사용자 build
String password = passwordEncoder().encode("1111");
auth.inMemoryAuthentication().withUser("user").password(password).roles("USER");
auth.inMemoryAuthentication().withUser("manager").password(password).roles("MANAGER", "USER");
auth.inMemoryAuthentication().withUser("admin").password(password).roles("ADMIN", "MANAGER", "USER");
}
@Bean
public PasswordEncoder passwordEncoder() {
;
return PasswordEncoderFactories.createDelegatingPasswordEncoder();
}
@Override
public void configure(WebSecurity web) {
web.ignoring()
.antMatchers("/favicon.ico", "/**/favicon.ico");
web.ignoring()
.requestMatchers(PathRequest.toStaticResources().atCommonLocations());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/mypage/**").hasRole("USER")
.antMatchers("/messages/**").hasRole("MANAGER")
.antMatchers("/config/**").hasRole("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin();
}
}
감사합니다.
답변 1
0
resource 폴더밑에 사이즈 0인 favicon.ico파일 하나 만들어놓으시면 됩니다.
0
답변 감사드립니다. 윤영철님께서 말씀하신 방법대로도 해결 가능할 것 같지만, 근본적인 문제는 크롬 확장프로그램 AdGuard 때문이었네요... 좋은 하루 되세요!
0
제거 오늘 오전에 테스트 해 보았을 때는, AdGuard 를 종료했을 때 302 redirect가 안 됐는데 조금 전에 다시 실행시켜보니 302 redirect 가 돼서 말씀해주신 방법되로 favicon.ico 파일을 직접 추가 했습니다. 더 이상 302가 발생되지 않네요. 답변 정말 감사합니다.
시큐리티 공부 버전 질문
0
192
1
[해결 방법] MethodSecurityConfig.customMethodSecurityMetadataSource() 호출하지 않는 이슈
0
199
1
AbstractSecurityInterceptor.class.beforeInvocation()를 2번 실행하는 경우
0
187
1
강의 코드가 왜이렇게 뒤죽박죽인가요...
0
271
1
메인 페이지로 접속해도 login url로 리다이렉트가 되지 않습니다..
0
248
1
파라미터값이 넘어가지 않습니다 ....
0
382
1
security filterChain 설정 질문이 있습니다.
0
337
1
소스 부분 질문 드립니다.
0
214
2
섹션4 7번 강의 문제가 있는거 같네요.
0
352
2
파일이 수시로 이름이 바껴있네요 ㄷㄷ
0
312
1
HttpSessionSecurityContextRepository를 사용안하는 문제
0
566
2
error , exception 이 잘 안됩니다.
0
290
2
thymeleaf tag 질문합니다.
0
201
2
버전업하면서 deprecated된 것들이 너무많아요
0
483
1
spring security 패치 관련
0
443
1
모바일을 사용할때 토큰말고 세션
0
870
2
DB 연동한 인가 부분에 대한 질문입니다!
0
270
1
Ajax방식도 똑같이 Session방식을 사용하는건가요?
0
314
1
Config 파일 생성 시 질문이 있습니다.
0
238
1
강사님 몇일동안 구글 검색만 100개 했는데도 이유를 모르겠습니다..
1
443
2
403 에러 뜹니다.
0
832
2
login_proc의 존재에 대한 간략한 설명입니다
0
284
1
top.html에 로그인 링크를 만들어서 로그인을 해봤습니다
0
295
2
안녕하세요. DB에 저장될 때 이해 안 가는 값이 있어서 질문드립니다!
0
196
1





