Spring Boot Thymeleaf allows client repository

32 views Asked by At

I'm actually encountering a problem with my view, in fact I'm tryng to display a pdf or at least a download button. The problem is that I cannot access the "pdf" directory that I created. He is as the same level as my JS directory.

The path is src/main /resources/static/pdf. When I check on my devtools, the request to the pdf is 404 error. and I'm tryng to reach them with relative path.

Path

Does anyone know how to solve this.

Here is my Security config :

@Configuration
@EnableWebSecurity
public class SecurityConfig {

    @Bean
    public BCryptPasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    /**
     * Laisse le controle aux controllers
     */
    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        return http.authorizeHttpRequests((auth) -> auth.anyRequest().permitAll()).build();
    }
}
1

There are 1 answers

3
espectro93 On

I suppose the file should be located under src/main/resources/static/pdf. The 404 message indicates no security issue. http://localhost:8080/pdf/file123.pdf should yield the correct file afterwards.