On 26/06/17 10:55, Jérémie Barthés wrote:
> Hi,
> 
> I have an issue between org.apache.catalina.valves.rewrite.RewriteValve
> and org.apache.catalina.servlets.DefaultServlets
> 
> If my request is forwarded by the RewriteValve and then pass into
> doDirectoryRedirect in DefaultServlets to be redirected. The hidden
> rewritten URI is displayed in the browser.
> 
> To test it, try the following example (any tomcat 8, 8.5 or 9)
> 
> add RewriteValve in conf/server.xml
> <Valve className="org.apache.catalina.valves.rewrite.RewriteValve"/>
> 
> add rewriteRule in conf/Catalina/localhost/rewrite.config
> RewriteRule ^/iWantThisVisible/(.*) $/examples/$1/
> 
> start tomcat
> 
> go to following URLs (any internet browser) :
> http://localhost:8080/iWantThisVisible/servlets
> http://localhost:8080/iWantThisVisible/servlets/

That behaviour is expected.

If you want to stick with the RewriteValve you'll need to write a custom
Valve or Filter to modify the HTTP headers on the way out.

You might be better off writing a custom Servlet that does a forward.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to