Closed ashishpratapsingh14 closed 7 years ago
Please provide more details. As it stands we don't have enough information to help
I am using URL based routeing configuration to my Service Which uses "REPORT" method with post body. Which means it's going to use SimpleHostRoutingFilter. And it's not sending any post body in case of "REPORT" type method.
We don't handle the REPORT
HTTP method in SimpleHostRoutingFilter
.
https://github.com/spring-cloud/spring-cloud-netflix/blob/master/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilter.java#L318
You could provide your own filter to modify the request further and forward on the body.
I handle it this way...
@Component
public class CustomBeanPostProcessor implements BeanPostProcessor {
...
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
logger.debug("[CUSTOM_DEBUG] CustomBeanPostProcessor.postProcessBeforeInitialization() [beanName:: "+beanName+"]");
if(SimpleHostRoutingFilter.class.isAssignableFrom(bean.getClass())){
return new CustomHostRoutingFilter(helper, zuulProperties);
}
return bean;
}
...
}
is it correct way to do?
I was thinking you could add your own ZuulFilter
the does something similar to SimpleHostRoutingFilter
for the REPORT
method.
REPORT
isn't a standard HTTP method, so I'm not sure this warrants an enhancement. https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html. It's specific to webdav http://ietf.org/rfc/rfc3253.
I can buy that, I didnt even know it existed till I saw this issue :) I looked it up and read what it was used for but didnt think to look any further.
I tried doing that only but I was not able to stop executing SimpleHostRoutingFilter After my filter runs that's why I replaced it with following code.
public class CustomHostRoutingFilter extends SimpleHostRoutingFilter {
...
@Override
protected HttpRequest buildHttpRequest(String verb, String uri, InputStreamEntity entity,
MultiValueMap<String, String> headers, MultiValueMap<String, String> params) {
HttpRequest httpRequest;
switch (verb.toUpperCase()) {
case "REPORT":
HttpReport httpReport = new HttpReport(uri + this.helper.getQueryString(params));
httpRequest = httpReport;
httpReport.setEntity(entity);
httpRequest.setHeaders(convertHeaders(headers));
return httpRequest;
default:
return super.buildHttpRequest(verb, uri, entity, headers, params);
}
}
...
}
That is another option as well. I am going to close this issue for now. If we see a high demand for supporting REPORT
than we can discuss it again.
For HTTP Method "REPORT" post data is not passing to service. While I am hitting service directly it's responding as expected.