Closed mjeanroy closed 1 year ago
We aren't adding any new features to Zuul 1.x, but we will maintain/fix bugs as needed. I think for your specific use case, you can decorate the class and fix it for your own purposes. Otherwise, maybe the Spring folks will be willing to give you some input. Cheers.
Hi,
First of all, I'm using Zuul in version 1.3.0 with spring-cloud-netflix-starter-netflix-zuul in version 1.4.4.
I have a problem in my application with the
SendErrorFilter
(from spring-cloud) when the filter forward the request to the error handler: in this case the request parameter are not correctly handled by theHttpServletRequestWrapper
instance.Here is an explanation of what happened:
1- In the
SendErrorFilter#run
method, the handler retrieved theApplicationDispatcher
to forward the request to the/error
path. Note that the request parameters have already been read in this case, soHttpServletRequestWrapper#parameters
is notnull
. 2- I'm using tomcat 8.5.23, so in this case, theApplicationDispatcher
is an instance oforg.apache.catalina.core.ApplicationDispatcher
3- During the forward operation, the ApplicationDispatcher mutate the original request wrapper and call thesetRequest
on it and the request parameters are not the same anymore. 4- When the request is rendered (a simple JSP), the request parameters are not resolved correctly, since theHttpServletRequestWrapper#parameters
have already been computed...Not sure if it's clear, not easy to explain, sorry, let met know if you want me to rephrase it,, or I can try to give you a sample application if needed.
There is a mix here with spring-cloud, tomcat and Zuul, but I think the problem is with the
HttpServletRequestWrapper
which does not reset appropriate fields when the original request is set, what do you think?I looked at the repository and I can see that zuul is now in version 2, is the 1.X version still maintained?
If not, we can plan on our side a migration and see if the problem still occurs, otherwise, and if you agree, I can work on PR. I think a simple solution could be to override the
setRequest
method inHttpServletRequestWrapper
and resetting theparameters
(reset it tonull
) map when it happened.What do you think?