Page 1 of 1

url rewrite using tuckey.org

Posted: Wed Sep 12, 2012 6:32 pm
by srini
Hi,

I am trying to do url rewrite using tuckey following the steps from http://tuckey.org/urlrewrite/. After adding tuckey filter in web.xml before springSecurityFilterChain, I am not able to access to application. I feel like, I am missing something simple but couldn't figure out. Any help would be appreciated.

Thanks,
Srini.

Re: url rewrite using tuckey.org

Posted: Thu Sep 13, 2012 10:29 am
by jfridye
srini wrote:Hi,

I am trying to do url rewrite using tuckey following the steps from http://tuckey.org/urlrewrite/. After adding tuckey filter in web.xml before springSecurityFilterChain, I am not able to access to application. I feel like, I am missing something simple but couldn't figure out. Any help would be appreciated.

Thanks,
Srini.


Could you post the contents of your filter/web.xml here?

Re: url rewrite using tuckey.org

Posted: Fri Sep 14, 2012 10:07 am
by srini
Thanks Joseph for the reply. I forgot to add the dependency in site-war along with main pom.xml. Now I am able to redirect from localhost:8080/gallery to /store/Gallery/catalog but I am still not able to change the outbound url from /store/Gallery/catalog to /gallery. I am hoping, I can mask home page url also the sameway from localhost:8080/home to localhost:8080 if this is working. I would appreciate any help/advise you can provide.

Below are the filters I added in web.xml and the rules I added in urlrewrite.xml
web.xml
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

urlrewrite.xml
<rule>
<from>^/gallery$</from>
<to type="redirect">/store/Gallery/catalog</to>
</rule>
<outbound-rule>
<from>^/store/Gallery/catalog$</from>
<to>/gallery</to>
</outbound-rule>

Thanks,
Srini.

Re: url rewrite using tuckey.org

Posted: Fri Sep 14, 2012 5:13 pm
by aazzolini
Is there a reason you're required to use the tuckey library?

If I were you, I'd set up an Apache httpd instance to sit in front of my application server and handle rewrites there. It will be more performant and it's a good idea in general to not serve users directly from Tomcat.

Re: url rewrite using tuckey.org

Posted: Fri Sep 14, 2012 7:28 pm
by srini
Thanks Andre for the suggestion. That is where I started in the first place but I ran into issues when I added rewrite rules to .htaccess at the document root (/var/www). I was not getting images served from document root. I try to add to httpd.conf, but no rewrites are done. I am using turnkey tomcat on apache version 11.3.

Thanks,
Srini.