Wheels 1.0 on tomcat behind apache: url rewrite problem

103 views
Skip to first unread message

Colin

unread,
Apr 24, 2013, 12:33:56 PM4/24/13
to cfwh...@googlegroups.com
I had this working on the coldfusion server with nginx, so I know it can work. But now I'm using apache on a server that is shared with other applications.

In config/settings I have

<cfset set(URLRewriting="On")>

From what I've read I shouldn't really need that last line. Taking it out gives me auto-generated urls like http://server/myapp/index.cfm?controller=approvals. But leaving it in gives me https://server/myapp/index.cfm/approvals. And I get a Tomcat 404 with that index.cfm thrown in there. It also throws a 404 if you manually enter https://server/myapp/approvals.

Here's the rest of my rewriting setup:

In my application's root folder (not the wwwroot) I have the .htaccess with appropriately uncommented lines, but modified to act on my app's subfolder.

Options +FollowSymLinks

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/myapp/(flex2gateway|jrunscripts|cfide|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|sitemap.xml|rewrite.cfm)($|/.*$) [NC]
RewriteRule ^/myapp/(.*)$ ./rewrite.cfm/$1 [L]
 

In my httpd.conf file I have the directory for the application specified to allow overrides:

<Directory "/myapp">
    AllowOverride All
</Directory>

Has anyone else had this problem? The most immediate problems are that (a) links aren't being generated properly, and (b) friendly urls aren't being redirected to rewrite.cfm.

Colin

unread,
Apr 24, 2013, 6:00:45 PM4/24/13
to cfwh...@googlegroups.com
I'm reading up on path_info and tomcat, and it looks like you have to specify the app's directory when you define the servlet (presumably the Coldfusion servlet). So since my app is in /myapp I would need to the servlet for that url pattern. I'm on a server with dozens of other apps, so that won't work.

AJ Mercer

unread,
Apr 24, 2013, 10:57:10 PM4/24/13
to cfwh...@googlegroups.com
maybe try
RewriteRule ^/myapp/(.*)$ /myapp/rewrite.cfm/$1 [L]


--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cfwheels+u...@googlegroups.com.
To post to this group, send email to cfwh...@googlegroups.com.
Visit this group at http://groups.google.com/group/cfwheels?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

AJ Mercer
<webonix:net strength="Industrial" /> | <webonix:org community="Open" />
http://twitter.com/webonix

Colin

unread,
Apr 25, 2013, 2:14:31 PM4/25/13
to cfwh...@googlegroups.com
Thanks. That's the syntax you would use when putting the rewrite rule in httpd.conf, rather than .htaccess. I tried both.

Has anyone run wheels on Adobe Coldfusion on a Tomcat server? There are lots of posts about setting up Railo, but I don't think they apply here. Am I wrong?

The thing is that when you don't specify <cfset set(URLRewriting="On")> then wheels doesn't try to rewrite, even though in my dev environment it happened automagically.

When you do specify it, it inserts "index.cfm" before the friendly url, which breaks things. And when you manually enter the friendly url the way it should be written it gives a 404 error.
Reply all
Reply to author
Forward
0 new messages