Forum Moderators: phranque

Message Too Old, No Replies

Executing & displaying content from an application server?

         

Skjaeret

5:20 pm on Nov 5, 2004 (gmt 0)

10+ Year Member



Regardless of whether this is a good idea or not, here it is... :-)

A configuration has an Apache web server which handles everything (html, perl, php, etc.) with the single exception of Coldfusion. This is installed on a second server, running the Sun Application Server.

Using RedirectMatch, for example, it's very easy to instruct Apache to send anything that ends in .cfm to this second server. The problem is, that Coldfusion is now more than happy to display the output and start processing any link clicks that happen from this page -- essentially becoming your new web server.

This doesn't work for this setup, because everything else resides on the Apache server.

The question is: Is there a way to direct a .cfm file to the second server to be executed, but instead having the output "captured" and displayed by the Apache server...? In that way the user doesn't know a second server was involved, and most importantly, the second server never processes any links or html requests.

(For purposes of the discussion, no, it's not possible to run Apache and Coldfusion on the same server -- I know it's the more common option, but there ya go... :-)

jdMorgan

8:16 pm on Nov 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See Apache mod_proxy to allow your "html" server to pass cfm requests the second server as a proxy.

Jim

Skjaeret

8:53 pm on Nov 5, 2004 (gmt 0)

10+ Year Member



I have been looking at that, and it looks seriously promising. The only problem right now is that it appears that it will proxy only entire directories.

i.e., in a directory sample/, there might be sample/index.html and sample/script.cfm.

The proxy will handle the cfm file great, but it also proxies the html file over to the secondary server, and I don't want that.

Initially, I was hoping that a regular expression could be used to cull out only the files ending in .cfm, but it doesn't seem to permit that.

(I also thought of using the rewrite rules to rewrite the URL for anything that's a .cfm -- that works great, but the proxy directive only sees the original URL, not the rewritten one, so I can't seem to "cheat" in that way either (by rewriting the path to something unique)).

What I ultimately need is something that works along the line of:

ProxyPass (.*)\.cfm$ [server...]
ProxyPassReverse (.*)\.cfm$ [server...]

Skjaeret

9:56 pm on Nov 5, 2004 (gmt 0)

10+ Year Member



Well, I found a solution. Not quite the elegant approach I was aiming for (though I suppose this is elegant in it's own way):

ReWriteEngine on
RewriteRule (.*)\.cfm$ /cfm/$1.cfm [P]
ProxyPass /cfm [cfm.server...]
ProxyPassReverse /cfm [cfm.server...]

jdMorgan

10:51 pm on Nov 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should ba able to specify a "single" URL for ProxyPass if you like. There is no need to restrict yourself to directory level URLs.

Also, if needed, add ProxyRequests off for security reasons. You don't want people to be able to use your server to proxy through to other sites. This should be off by default, but try requesting http:www.yourdomain.com/http://yahoo.com/

If it works, you'll need to disable ProxyRequests.

Also, I got in a hurry and forgot the first time, so...

Welcome to WebmasterWorld!

Jim