On 1 June 2017 09:24:16 BST, Nicholas Cottrell <niccottr...@me.com> wrote: > >> On 31 May 2017, at 22:44, André Warnier (tomcat) <a...@ice-sa.com> >wrote: >> >> On 31.05.2017 21:52, Nicholas Cottrell wrote: >>>> On 5/31/17 8:42 AM, Nicholas Cottrell wrote: >>>>> Hi All! >>>>> >>>>> I'm having a problem setting up an existing webapp from Apache >>>>> 2.2/Tomcat6 on a new server running Centos 7, and the following >>>>> packages: >>>>> >>>>> httpd 2.4.6-45.el7.centos.4 tomcat.noarch >>>>> 7.0.69-11.el7_3 @updates tomcat-native.x86_64 >>>>> 1.1.34-1.el7 @epel >>>>> >>>>> For debugging I have enabled AJP/1.3 and 8009 and HTTP on 8080, >>>>> then use Apache to ProxyPass. >>>>> >>>>> With my initial configuration, data from a form POST is not >>>>> available via request.getParameter: >>>>> >>>>> ProxyPass / ajp://localhost:8009/ <ajp://localhost:8009/> ><ajp://localhost:8009/ <ajp://localhost:8009/>> retry=1 >>>>> acquire=3000 timeout=600 Keepalive=On ProxyPassReverse / >>>>> ajp://localhost:8009/ <ajp://localhost:8009/> ><ajp://localhost:8009/ <ajp://localhost:8009/>> >>>>> >>>>> But changing it to this fixes everything: >>>>> >>>>> ProxyPass / http://localhost:8080/ <http://localhost:8080/> ><http://localhost:8080/ <http://localhost:8080/>> retry=1 >>>>> acquire=3000 timeout=600 Keepalive=On ProxyPassReverse / >>>>> http://localhost:8080/ <http://localhost:8080/> ><http://localhost:8080/ <http://localhost:8080/>> >>>>> >>>>> In the broken instance, request.getParameter("x") returned null, >>>>> but request.getReader() returned bytes with "x=123" so seems that >>>>> Apache is sending the POST body but Tomcat is not processing it >>>>> correctly, yes? >>>>> >>>>> Please also see >>>>> >https://stackoverflow.com/questions/44167876/problems-with-post-parame ><https://stackoverflow.com/questions/44167876/problems-with-post-parame> >>>> ters-with-tomcat-ajp-on-apache-2-4-but-not-2-2 >>>>> ><https://stackoverflow.com/questions/44167876/problems-with-post-param ><https://stackoverflow.com/questions/44167876/problems-with-post-param> >>>> eters-with-tomcat-ajp-on-apache-2-4-but-not-2-2> >>>>> for my steps so far. >>>>> >>>>> I would prefer to switch back to AJP for the proxy, since I >>>>> understand it is more performant, right? Should I try forcing a >>>>> Tomcat 8 install to see if the problem persists there too? >>>> >>>> If you call request.getReader/getInputStream before any of the >>>> request.getParameter family of methods, then all >request.getParameter* >>>> methods will return null. That's because Tomcat must consume the >>>> request body in order to parse POST parameters. If you call >>>> request.getReader/getInputStream, then Tomcat assumes that you will >be >>>> handling the request body (and any associated parameters therein). >>>> >>>> Is it possible that you are "damaging" the request by inspecting >the >>>> request body? >>> >>> I've been thinking about that but I don't call >getReader/getInputStream anywhere myself. >>> Also, the fact that accessing the same page via 8080 directly to >Tomcat works, but via Apache/AJP through Tomcat's port 8009 works fine, >and setting the proxy to use the 8080 also works. >>> >> >> There must be a typo in the phrase above, or else what are you >complaining about ? > >Sorry - via AJP and port 8009 does NOT work, and I don't want to switch >production to Proxying via HTTP since I understand that's much less >performant.
Your understanding is incorrect. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org