第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Spring登錄表單從https切換為http

Spring登錄表單從https切換為http

富國滬深 2023-10-13 15:23:52
我們有一個(gè) Spring boot 應(yīng)用程序,在服務(wù)器上部署了 Spring security。我們使用 https,但是當(dāng)重定向到 Spring 默認(rèn)登錄表單時(shí),會(huì)使用 http 調(diào)用重定向,這會(huì)導(dǎo)致 503 服務(wù)不可用。我不明白為什么Spring要切換通信協(xié)議,有沒有辦法阻止它?我們的配置protected void configure(HttpSecurity http) throws Exception {    http        .authorizeRequests()            .antMatchers("/", "/home", "/status", "/actuator").permitAll()            .anyRequest().authenticated()            .and()        .formLogin()            .permitAll()            .and()        .logout()            .permitAll()            .and()        .csrf()            .disable();}要重定向的頁面:登錄 :
查看完整描述

2 回答

?
繁華開滿天機(jī)

TA貢獻(xiàn)1816條經(jīng)驗(yàn) 獲得超4個(gè)贊

這是一個(gè)代理問題,我只需在我的 application.properties 中添加以下行

server.tomcat.remote-ip-header=x-forwarded-for
server.tomcat.protocol-header=x-forwarded-proto


查看完整回答
反對(duì) 回復(fù) 2023-10-13
?
呼啦一陣風(fēng)

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超6個(gè)贊

嘗試顯式啟用HSTS:

protected void configure(HttpSecurity http) throws Exception {

? ? http

? ? ? ? .headers()

? ? ? ? ? ? .hsts()

? ? ? ? .authorizeRequests()

? ? ? ? ? ? .antMatchers("/", "/home", "/status", "/actuator").permitAll()

? ? ? ? ? ? .anyRequest().authenticated()

? ? ? ? ? ? .and()

? ? ? ? .formLogin()

? ? ? ? ? ? .permitAll()

? ? ? ? ? ? .and()

? ? ? ? .logout()

? ? ? ? ? ? .permitAll()

? ? ? ? ? ? .and()

? ? ? ? .csrf()

? ? ? ? ? ? .disable();

}


查看完整回答
反對(duì) 回復(fù) 2023-10-13
  • 2 回答
  • 0 關(guān)注
  • 141 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)