Wpis z mikrobloga

#java #spring #tomcat
Mirki, wracajac do https://www.wykop.pl/wpis/58920861/java-docker-tomcat-wbijam-na-stronke-https-10-1-2-/

czy ma ktos pomysl dlaczego dostaje Message The requested resource [/login.html] is not available
gdy w configu spring boota mam:

@Override
protected void configure(HttpSecurity http) throws Exception {

http.headers()
.frameOptions().sameOrigin()
.httpStrictTransportSecurity().disable();

http.requiresChannel()
.antMatchers("/login.html").requiresSecure();

http.formLogin()
.loginPage("/login.html")
.loginProcessingUrl("/check.action")
.and()
.logout()
.logoutSuccessUrl("/login.html")
.logoutUrl("/logout")
.and()
.authorizeRequests()
.antMatchers("/testAuthenticated.html")
.authenticated()
.antMatchers("/testPermitAll.html")
.permitAll()
.antMatchers("/login.html").permitAll()
.anyRequest().permitAll();
}

chodzilo mi tutaj o to, zeby /login.html byl zawsze po https, reszta moze byc http bo to juz za proxy stoi.
Gdy usune:
http.requiresChannel()
.antMatchers("/login.html").requiresSecure();

to oczywiscie zadziala, ale wtedy po http
  • 4
@93michu93: w przegladarce dostaje:
Request URL: http://localhost:8080/login.html
Request Method: GET
Status Code: 302
and

Request URL: https://localhost:8443/login.html
Request Method: GET
Status Code: 404
zeby /login.html byl zawsze po https, reszta moze byc http


@93michu93: A jest sens bawić się w takie rozdrabnianie się w konfiguracji? IMHO ten ich DSL pomimo, że spójny i logiczny to nie jest ani przyjemny ani łatwo utrzymywalny (właściwie to by potrzeba pokryć to wszystko testami integracyjnymi, żeby mieć pewność że jakaś dodatkowa kropka-dyrektywa nie zepsuje naszego "bezpieczeństwa"). Osobiście wolałbym temat wyboru HTTP / HTTPS pozostawić prawdziwemu proxy (nginx /