Can't get URL Rewrite Filter to work

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't get URL Rewrite Filter to work

masionas
Hi Guys,

I have searched the lists for a good filter to rewrite urls and found a post where David adviced to use Tuckey filter. So I downloaded that one, put the jar file in the lib folder and added conf info into web.xml of webapp in my component. In other words followed the guide from the lib developer. But it seems like it is just not loading. When I request http://localhost:8080/rewrite-status it shows Bad request 400 HTTP error.

Here is where I placed it in web.xml ( above ContextFilter)


...
    <filter>
        <filter-name>UrlRewriteFilter</filter-name>
        <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
        <init-param>
            <param-name>logLevel</param-name>
            <param-value>DEBUG</param-value>
        </init-param>

    </filter>
    <filter-mapping>
        <filter-name>UrlRewriteFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

 
    <filter>
        <filter-name>ContextFilter</filter-name>
        <display-name>ContextFilter</display-name>
        <filter-class>org.ofbiz.webapp.control.ContextFilter</filter-class>
        <init-param>
...



What I am missing?
Reply | Threaded
Open this post in threaded view
|

Re: Can't get URL Rewrite Filter to work

Jacques Le Roux
Administrator
I'm not sure David ever adviced to use Tuckey. I asked once but I got no clear answers but that OFBiz is already automatically
rewriting url to be search engines friendly.
I'm not sure why you want to rewrite URLs but why not using mod_rewrite direcly (though Tuckey should work also, I finally used
mod_rewrite) ? Note also tha Google is less and less prone to errors while indexing weird URLs.

HTH

Jacques

From: "masionas" <[hidden email]>

>
> Hi Guys,
>
> I have searched the lists for a good filter to rewrite urls and found a post
> where David adviced to use Tuckey filter. So I downloaded that one, put the
> jar file in the lib folder and added conf info into web.xml of webapp in my
> component. In other words followed the guide from the lib developer. But it
> seems like it is just not loading. When I request
> http://localhost:8080/rewrite-status it shows Bad request 400 HTTP error.
>
> Here is where I placed it in web.xml ( above ContextFilter)
>
>
> ...
>    <filter>
>        <filter-name>UrlRewriteFilter</filter-name>
>
> <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
> <init-param>
>            <param-name>logLevel</param-name>
>            <param-value>DEBUG</param-value>
>        </init-param>
>
>    </filter>
>    <filter-mapping>
>        <filter-name>UrlRewriteFilter</filter-name>
>        <url-pattern>/*</url-pattern>
>        <dispatcher>REQUEST</dispatcher>
>        <dispatcher>FORWARD</dispatcher>
>    </filter-mapping>
>
>
>    <filter>
>        <filter-name>ContextFilter</filter-name>
>        <display-name>ContextFilter</display-name>
>        <filter-class>org.ofbiz.webapp.control.ContextFilter</filter-class>
>        <init-param>
> ...
>
>
>
> What I am missing?
> --
> View this message in context: http://www.nabble.com/Can%27t-get-URL-Rewrite-Filter-to-work-tp21919012p21919012.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Can't get URL Rewrite Filter to work

masionas
Actually, yes. I am sorry. That was not David. The topic I was talking about is
http://www.nabble.com/URL-Rewriting-td13436253.html#a13436253

But anyway, you say "why not using mod_rewrite direcly?" Could you please be more specific?

As I understand in order to use Apache's mod_rewrite I have to put Apache HTTPD as front-server and use mod_jk as Tomcat connector? Or is there any other way?

jacques.le.roux wrote
I'm not sure David ever adviced to use Tuckey. I asked once but I got no clear answers but that OFBiz is already automatically
rewriting url to be search engines friendly.
I'm not sure why you want to rewrite URLs but why not using mod_rewrite direcly (though Tuckey should work also, I finally used
mod_rewrite) ? Note also tha Google is less and less prone to errors while indexing weird URLs.

HTH

Jacques
Reply | Threaded
Open this post in threaded view
|

Re: Can't get URL Rewrite Filter to work

Jacques Le Roux
Administrator
No there are no other ways. But it's far simpler to use mod_proxy_ajp than mod_jk
http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-Howtousemodproxyajp

Jacques

From: "masionas" <[hidden email]>

>
> Actually, yes. I am sorry. That was not David. The topic I was talking about
> is
> http://www.nabble.com/URL-Rewriting-td13436253.html#a13436253
>
> But anyway, you say "why not using mod_rewrite direcly?" Could you please be
> more specific?
>
> As I understand in order to use Apache's mod_rewrite I have to put Apache
> HTTPD as front-server and use mod_jk as Tomcat connector? Or is there any
> other way?
>
>
> jacques.le.roux wrote:
>>
>> I'm not sure David ever adviced to use Tuckey. I asked once but I got no
>> clear answers but that OFBiz is already automatically
>> rewriting url to be search engines friendly.
>> I'm not sure why you want to rewrite URLs but why not using mod_rewrite
>> direcly (though Tuckey should work also, I finally used
>> mod_rewrite) ? Note also tha Google is less and less prone to errors while
>> indexing weird URLs.
>>
>> HTH
>>
>> Jacques
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Can%27t-get-URL-Rewrite-Filter-to-work-tp21919012p21932575.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: Can't get URL Rewrite Filter to work

David Legg

> No there are no other ways. But it's far simpler to use mod_proxy_ajp
> than mod_jk
> http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-Howtousemodproxyajp

In theory, you should be able to write a Tomcat filter to do this and
indeed I came across one [1].  Unfortunately when I tried it a couple of
years ago I couldn't get it to fully work.  That's a shame because using
a full blown Apache server when a single Tomcat instance would suffice
is overkill.

If anyone has more success let me know!

Regards,
David Legg

[1] http://tuckey.org/urlrewrite/

>
> Jacques
>
> From: "masionas" <[hidden email]>
>>
>> Actually, yes. I am sorry. That was not David. The topic I was
>> talking about
>> is
>> http://www.nabble.com/URL-Rewriting-td13436253.html#a13436253
>>
>> But anyway, you say "why not using mod_rewrite direcly?" Could you
>> please be
>> more specific?
>> As I understand in order to use Apache's mod_rewrite I have to put
>> Apache
>> HTTPD as front-server and use mod_jk as Tomcat connector? Or is there
>> any
>> other way?
>>
>>
>> jacques.le.roux wrote:
>>>
>>> I'm not sure David ever adviced to use Tuckey. I asked once but I
>>> got no
>>> clear answers but that OFBiz is already automatically rewriting url
>>> to be search engines friendly.
>>> I'm not sure why you want to rewrite URLs but why not using mod_rewrite
>>> direcly (though Tuckey should work also, I finally used mod_rewrite)
>>> ? Note also tha Google is less and less prone to errors while
>>> indexing weird URLs.
>>>
>>> HTH
>>>
>>> Jacques
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Can%27t-get-URL-Rewrite-Filter-to-work-tp21919012p21932575.html 
>>
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Can't get URL Rewrite Filter to work

David Legg
In reply to this post by Jacques Le Roux
Oh dear!  That'll teach me to jump into a thread before reading from the
beginning!  I see you *were* talking about the Tuckey filter in the
first place.

To solve my problem I use the Slatkovik filter [1] which at least allows
me to redirect requests to http://example.com to
http://www.example.com.  It isn't as powerful as the Tuckey filter but
at least it works!

Regards,
David Legg

[1] http://www.zlatkovic.com/httpredirectfilter.en.html
Reply | Threaded
Open this post in threaded view
|

Re: Can't get URL Rewrite Filter to work

Jacques Le Roux
Administrator
Do you mean that Tuckey does not work well ? Did you test it ?

Thanks

Jacques

From: "David Legg" <[hidden email]>

> Oh dear!  That'll teach me to jump into a thread before reading from the
> beginning!  I see you *were* talking about the Tuckey filter in the
> first place.
>
> To solve my problem I use the Slatkovik filter [1] which at least allows
> me to redirect requests to http://example.com to
> http://www.example.com.  It isn't as powerful as the Tuckey filter but
> at least it works!
>
> Regards,
> David Legg
>
> [1] http://www.zlatkovic.com/httpredirectfilter.en.html
>

Reply | Threaded
Open this post in threaded view
|

Re: Can't get URL Rewrite Filter to work

David Legg

Jacques Le Roux wrote:
> Do you mean that Tuckey does not work well ? Did you test it ?

I'm sorry.  I looked in my diary for 2006 and stupidly didn't write down
the exact reason why I removed the Tuckey filter and re-installed the
zlatkovic one.

 From memory, I got straight redirection working but couldn't get the
regular expression matching side to work.  As a result I lost confidence
in the program and went back to something I could trust better.

Regards,
David Legg



Reply | Threaded
Open this post in threaded view
|

Re: Can't get URL Rewrite Filter to work

David Legg

David Legg wrote:
> From memory, I got straight redirection working but couldn't get the
> regular expression matching side to work.  As a result I lost
> confidence in the program and went back to something I could trust better.

I remember a little more now!  I think I found that re-writing an
incoming URL was fine but that is only half the job as you also need
something that will re-write the links in a page's response and that's
what I couldn't get to work.

Now that may be a problem for any filter and not unique to Tuckey.  
However, I couldn't get it to work so I abandoned the idea.

Regards,
David Legg
Reply | Threaded
Open this post in threaded view
|

Re: Can't get URL Rewrite Filter to work

Jacques Le Roux
Administrator
Thanks for sharing David,

I will maybe add a FAQ for that (even if it's not often asked for ;o)

Jacques

From: "David Legg" <[hidden email]>

>
> David Legg wrote:
>> From memory, I got straight redirection working but couldn't get the
>> regular expression matching side to work.  As a result I lost
>> confidence in the program and went back to something I could trust better.
>
> I remember a little more now!  I think I found that re-writing an
> incoming URL was fine but that is only half the job as you also need
> something that will re-write the links in a page's response and that's
> what I couldn't get to work.
>
> Now that may be a problem for any filter and not unique to Tuckey.  
> However, I couldn't get it to work so I abandoned the idea.
>
> Regards,
> David Legg
>

Reply | Threaded
Open this post in threaded view
|

Re: Can't get URL Rewrite Filter to work

Jacques Le Roux
Administrator
Done; look for "How to make redirection inside an application server without using mod_rewrite"
in http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo

Jacques

From: "Jacques Le Roux" <[hidden email]>

> Thanks for sharing David,
>
> I will maybe add a FAQ for that (even if it's not often asked for ;o)
>
> Jacques
>
> From: "David Legg" <[hidden email]>
>>
>> David Legg wrote:
>>> From memory, I got straight redirection working but couldn't get the
>>> regular expression matching side to work.  As a result I lost
>>> confidence in the program and went back to something I could trust better.
>>
>> I remember a little more now!  I think I found that re-writing an
>> incoming URL was fine but that is only half the job as you also need
>> something that will re-write the links in a page's response and that's
>> what I couldn't get to work.
>>
>> Now that may be a problem for any filter and not unique to Tuckey.  
>> However, I couldn't get it to work so I abandoned the idea.
>>
>> Regards,
>> David Legg
>>
>