Getting Started with Taffy (Apache Configuration?)

104 views
Skip to first unread message

Matt Quackenbush

unread,
Apr 5, 2012, 2:14:42 PM4/5/12
to taffy...@googlegroups.com
Well, I finally have a reason to actually write a web service, and so I'm finally getting a chance to play with Taffy. It's only been on the "I really want to play with this" list for a year now. ;-)

I'm having a little bit of difficulty getting everything setup and working properly, which means that I probably have something screwed up in my Apache config. I have gone through a wide variety of configurations, which I've successfully failed to track (sorry!). This is my current configuration, which has me pretty damn close.

<VirtualHost *:80>
        ServerName taffytest
        DocumentRoot /home/matt/webfun/taffytest/webroot
        DirectoryIndex index.cfm

        RewriteEngine On

        # Redirect requests with "index.cfm" to root:
        RewriteRule  ^/index.cfm/([a-zA-Z0-9/-]+)$  /$1  [NS,R=301,L]

        # If not a directory, rewrite to /index.cfm/foo:
        RewriteCond  %{DOCUMENT_ROOT}%{REQUEST_URI}  !-d
        RewriteRule  ^([a-zA-Z0-9/-]+)$  /index.cfm%{REQUEST_URI}  [PT]

        ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8039/$1$2
</VirtualHost>

I have also created a little test of my own at the root level (e.g. http://taffytest/). I put in a quick little get test, and it returns the JSON string that I expect. YAY!

If I browse to http://taffytest/examples/api/, I am redirected to /examples/api/?dashboard, and the dashboard appears nicely. YAY!

When I select "Mock Client" and enter `/artists` as the URI and hit [get], I am returned the wonderful Tomcat 404 error telling me that "The requested resource (/examples/api/index.cfm/artists) is not available." BOO!

Any idea what I am missing?

Adam Tuttle

unread,
Apr 5, 2012, 3:12:10 PM4/5/12
to taffy...@googlegroups.com
Looks like your rewriting stuff assumes that everything is at the root, (^/index.cfm...) so I think that the stuff in the examples subfolder wouldn't match that.

Failing that, I would start simple by turning off the rewriting and just try to get it working that way first.

Adam

Matt Quackenbush

unread,
Apr 5, 2012, 6:38:52 PM4/5/12
to taffy...@googlegroups.com
Adam,

Thanks for the reply. What you are saying makes sense, and is probably part of my issue. Another part is possibly the ProxyPassMatch. I think what's happening is that the ProxyPassMatch is passing the request off to Tomcat before the .htaccess (/examples/api/.htaccess) can have any affect.

When I replace


RewriteRule  ^([a-zA-Z0-9/-]+)$  /index.cfm%{REQUEST_URI}  [PT]

with
RewriteRule  ^([a-zA-Z0-9/-]+)$  index.cfm%{REQUEST_URI}  [PT]

or

RewriteRule  ^(.*)$  index.cfm%{REQUEST_URI}  [PT]

or

RewriteRule  ^(.*)$  index.cfm/$1

everything remains the same on the /examples/api/ stuff, while my root app receives a "Your browser sent a request that this server could not understand." error message.

Is anyone by chance using Taffy with ProxyPassMatch and Tomcat?

Railo 3.3.2.003
Tomcat 6.0.28
Apache 2.2.x

Thanks for your help. :-)

Adam Tuttle

unread,
Apr 5, 2012, 8:23:19 PM4/5/12
to taffy...@googlegroups.com
Sounds reasonable. I'm not really that familiar with ProxyPass (I bet Todd Rafferty is, he's a Tomcat Guru compared to myself... @webrat on twitter), so I don't know anything about the order of stuff that's going on there.

Could you possibly expand the range of things that are being proxied to include the stuff you think is slipping through the cracks?

Adam

Matt Quackenbush

unread,
Apr 6, 2012, 2:55:36 PM4/6/12
to taffy...@googlegroups.com
I've not yet had a chance to check with Todd (86 irons in the fire; you know how it goes!), but I'm curious if what I'm trying to do here should even work with Taffy. It may be that it shouldn't, so let me take a step back and ask you about it.

I was trying to create a small test application of my own in the webroot, while also running the example applications as their own apps under /examples. Thus far I have been unsuccessful at that. Should it be possible, or does Taffy assume that it is one single application under a particular webroot?

Adam Tuttle

unread,
Apr 6, 2012, 3:06:57 PM4/6/12
to taffy...@googlegroups.com
Taffy can run in any subfolder, and in multiple places on the same server. Of course you only need 1 taffy folder/mapping.


Adam

Matt Quackenbush

unread,
Apr 6, 2012, 3:08:42 PM4/6/12
to taffy...@googlegroups.com
OK. I assumed that was the case, since there are multiple Taffy applications in the examples. Heh. Off to ping Todd to see what I'm missing on the rewrites, etc. ;-)

Thanks!

Adam Tuttle

unread,
Apr 9, 2012, 8:32:37 PM4/9/12
to taffy...@googlegroups.com
I wonder if your issue is this one: https://github.com/atuttle/Taffy/issues/55

In the comment thread there he mentioned that he was using Proxying. I merged in his fix for it tonight. Try the latest BER and see if that fixes it. :)

Adam

Matt Quackenbush

unread,
Apr 9, 2012, 8:47:20 PM4/9/12
to taffy...@googlegroups.com
Hey Adam. I will definitely give that a whirl either later this evening or in the AM. Thanks!
Reply all
Reply to author
Forward
0 new messages