<div dir="ltr">So, in my bid to put the predicate language through the paces, I&#39;ve been testing out all the rewrite rules I&#39;ve ever used with mod_rewrite or Tuckey Rewrite to see if Undertow&#39;s handlers are up to the task.  <div><br></div><div>I&#39;ve run into an issue again with probably the most common rewrite rule of any CFML app using an MVC framework, which is a rule that creates so-called &quot;SES&quot; URLs and force all requests through a front controller design pattern.  </div><div><br></div><div>Basically</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="monospace"><a href="http://site.com/home/about">site.com/home/about</a></font></blockquote><div><br></div><div>gets rewritten to</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="monospace"><a href="http://site.com/index.cfm/home/about">site.com/index.cfm/home/about</a></font></blockquote><div><br></div><div>Here you can see how this rule is typically accomplished in Apache httpd, Nginx, IIS, and Tuckey:</div><div><br></div><div><a href="https://coldbox.ortusbooks.com/the-basics/routing/requirements/rewrite-rules">https://coldbox.ortusbooks.com/the-basics/routing/requirements/rewrite-rules</a> </div><div> <br></div><div>The hang up is that<i> any incoming path that maps to an actual file</i> skips the rewrite rule.  That way<b> /images/logo.jpg</b> doesn&#39;t get rewritten. </div><div><br></div><div>So here was my first stab at it with Undertow&#39;s predicate language-- it seemed simple enough:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="monospace">not file and not directory -&gt; rewrite(&#39;/index.cfm/%{RELATIVE_PATH}&#39;)</font></blockquote><div><br></div><div>But our old friend the servlet of course is nowhere to be found since my &quot;file&quot; and &quot;directory&quot; predicates were executing in the root handler chain so there is no concept of a servlet&#39;s context root with which to resolve file system paths. </div><div><br></div><div>So basically, I understand exactly why this doesn&#39;t work, but I feel that we need to find a way to make this work.  This is a feature that pretty much every rewrite engine I&#39;ve ever used has-- the ability to test the file system to see if a file or directory exists.  Can we discuss the following options?</div><div><ul><li>Find a way for the root handler chain to access the deployment&#39;s resource manager </li><li>Find a way for the rewrite handler to correctly affect not only the exchange but also (optionally) the HttpServletRequest so it&#39;s possible to rewrite the URL inside of the servlet&#39;s handler chain. I know for certain this is possible because the Tuckey Rewrite engine is implemented as a servlet filter.</li></ul></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>I would prefer the first option since I do like having the predicates in the root handler chain so it can run as early as possible.</div><div><br></div><div>Thanks!</div><div><br></div><div>~Brad</div><div><br></div><div><b>Developer Advocate</b></div><div><i>Ortus Solutions, Corp </i></div><div><b><br></b></div><div>E-mail: <a href="mailto:brad@coldbox.org" target="_blank">brad@coldbox.org</a></div><div>ColdBox Platform: <a href="http://www.coldbox.org" target="_blank">http://www.coldbox.org</a> </div><div>Blog: <a href="http://www.codersrevolution.com" target="_blank">http://www.codersrevolution.com</a></div><div><br></div></div></div></div></div></div></div></div>