elkman commented on pull request #479:
URL: https://github.com/apache/tomcat/pull/479#issuecomment-1054500688


   A valid UseCase for me would be: _Migration of an application to a new 
context_
   
   `https://host/myOldApp` -> `https://host/myNewApp`
   
   In this case you would forward both URL prefixes from the load 
balancer/proxy to the Tomcat and define a rewrite rule that redirects all 
requests to the old context to the new one.
   
   `RewriteRule ^/myOldApp/(.*)$ /myNewApp/legacy/$1 [R=301,L]`
   
   But since there exists no context for myOldApp, this would result in an NPE.
   
   (And yes, of course the Tomcat terminates TLS in this case and not the load 
balancer, otherwise you would do the redirect there of course.)
   
   I would prefer to handle such _misconfiguration_ by the RewriteValve in a 
understandable way without debugging into Tomcat codebase. But I don't see any 
practical way for reliable detection by the RewriteValve. Neither when loading 
the rule configuration, nor at runtime (except to catch the NPE). 
   Instead of using default values, a specific exception could be generated. 
Then the error handling could be realized in the calling component, but this 
would violate the API.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to