Thank you for the response. I am finally able to confirm the issue. When I put the following line in comment, everything works fine. I mean as expected.
*<!-- <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /> -->* If the above line UpgradeProtocol is activated, I observe now at least two weird situations. 1) As mentioned before, RewriteValve does not work as expected. 2) Besides it, I observed that serviet behaviors weird. According to the log file it seems that a servlet is sometimes called *twice by one request*. This is a snapshot of my log files. You can see that two https-443-exec are called almost at the same time. 06-Feb-2020 13:38:04.676 SEVERE *[https-openssl-apr-443-exec-9]* org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [uploadServlet] in context with path [] threw exception org.apache.commons.fileupload.MultipartStream$MalformedStreamException: Stream ended unexpectedly 06-Feb-2020 13:38:04.999 SEVERE *[https-openssl-apr-443-exec-2]* org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [uploadServlet] in context with path [] threw exception org.apache.commons.fileupload.MultipartStream$MalformedStreamException: Stream ended unexpectedly Best regards, Hua On Wed, Feb 5, 2020 at 2:15 PM Felix Schumacher < felix.schumac...@internetallee.de> wrote: > Am 04.02.2020 22:16, schrieb Hua Zhang: > > What I mean with word 'works' is: the RewriteRule has been executed. > > > > That is not the case by HTTPS. The rule has not been executed while the > > RewriteCond is fulfilled. > > Can you give us more information on your setup? Is there any > Proxy/Loadbalancer in front of your tomcat? If so, can you show us > details on that setup? > What is the value of the host request header in both cases? > > Felix > > > > Olaf Kock <tom...@olafkock.de> 于 2020年2月4日周二 下午9:06写道: > > > >> > >> On 04.02.20 20:31, Hua Zhang wrote: > >> > Best tomcat team, > >> > > >> > Hereby I have a question about an issue I found by using RewriteValve > >> > on tomcat 9.30 > >> > > >> > The rewrite.config is very simple: > >> > > >> > /RewriteCond %{HTTP_HOST} =youkoop.com <http://youkoop.com> > >> > RewriteRule ^.*$ https://www.youkoop.com [R=301,L] > >> > / > >> > > >> > All I want is just redirect a naked root domain to a www domain with > >> > HTTPS. > >> > > >> > The redirection works on HTTP but not HTTPS. > >> > > >> > http://youkoop.com => https://www.youkoop.com *works* > >> > > >> Note: Images don't get through in this mailing list. I can imagine > >> what > >> "works" means, but for your next example: Please elaborate what "does > >> not work" means. > >> > > >> > *https*://youkoop.com <http://youkoop.com> => > >> > https://www.youkoop.com *does not work* > >> > >> First thing to test: Does https://youkoop.com work without the > >> redirect, > >> then with the "wrong" host name? Otherwise it might be as simple as a > >> misconfigured TLS host that's never invoked because of a certificate > >> mismatch. > >> > >> Olaf > >> > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >