java - 未找到基本域的严格传输安全标头
问题描述
我有一个 Spring Boot 应用程序,我想在我的域上启用 HSTS(比如 https:example.com)。我在 WebSecurityConfigurerAdapter 中编写了脚本。代码片段如下所示。
@EnableWebSecurity
@Configuration
@Order(1)
public static class ApiWebSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests()
.antMatchers(HttpMethod.TRACE, "/**").denyAll()
.antMatchers("/**").permitAll();
http
.antMatcher("/**").httpBasic()
.and().csrf().disable()
.headers().httpStrictTransportSecurity()
.includeSubDomains(true)
.maxAgeInSeconds(31536000);
// @formatter:on
}
}
Spring Boot 应用程序的部署发生在 Azure 云中。部署后,当我点击基域时,我没有看到 HSTS 标头。但是我可以在点击整个 URL 时看到标题(比如https://example.com/questions/ask)。任何帮助,将不胜感激。谢谢!
解决方案
推荐阅读
- javascript - RGraph : Uncaught TypeError: (intermediate value).draw(...).responsive 不是一个函数
- java - 重复使用 Oauth2 凭据来访问 YouTube api
- jax-rs - 类文件 javax/ws/rs/core/Application 中非本机或抽象方法中的缺失代码属性
- javascript - Vue 按选择的选项搜索——即使选择也不能按 id 搜索
- c++ - 我想减少在 C++ 中对 1 亿个复杂数据计算 2D FFT 的时间
- xml - 如何使用 shell 脚本从 xml 文件中提取值?
- python - 解析没有 / 标记的表并且数据嵌套在标签 - beautifulsoup、selenium 和 webdriver_manager
我正在尝试获取此 url =“https://www.topuniversities.com/university-rankings/university-subject-rankings/2021/psychology”中的所有表格。问题是没有
table
标签,也没有<tr>
- reactjs - 我应该如何修改代码以调用 API 并返回数组?
- c# - 表单识别器自定义模型在预测过程中返回错误,错误代码为 3014
- java - org.hibernate.hql.internal.ast.QuerySyntaxException:InspectionRequestEntity 未映射