0
我想禁用服务器上的Trace动词,以便端点无法追踪。Spring MVC跟踪Http请求
我的端点使用Spring MVC和有一个选项endpoints.trace.enabled=false.
疼痛是如何测试这一点,如果跟踪被禁用或不创建。我尝试了Chrome插件实时HTTP标题,但它用于通用网站。我想检查我的端点。
例如:
卷曲--insecure -v -X TRACE -H http://localhost:8080/toy/49f6a7d3-eb20-3ab2-be3b-8399e7f28abf
HTTP/1.1 200 OK
< Date: Sat, 21 Mar 2015 04:34:03 GMT
< Content-Type: message/http; charset=UTF-8
< Content-Length: 270
<
TRACE /toy/49f6a7d3-eb20-3ab2-be3b-8399e7f28abf HTTP/1.1
User-Agent: curl/7.37.1
Host: localhost:8080
Accept: */*
* Connection #0 to host localhost left intact
下面我尝试,但现在它拒绝所有的请求。
@Configuration
@EnableWebMvcSecurity
@EnableGlobalMethodSecurity(securedEnabled=true, prePostEnabled = true, jsr250Enabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.requestMatchers()
.and()
.csrf().disable()
.authorizeRequests()
.antMatchers(HttpMethod.TRACE, "/**").denyAll();
}
}
我们在Spring MVC中使用jetty inbuild。 – plzdontkillme 2015-03-19 05:19:21
对于使用哪个应用程序服务器或容器来说,卷曲并不重要。重要的部分是你可以用这种你想要的方式轻松地看到答案。 – erhun 2015-03-19 09:21:57
@plzdontkillme你需要告诉我们你正在使用什么版本的Jetty。不要害羞 – 2015-03-22 01:20:59