Adam Tuttle

Getting nothing but 404's for ColdFusion 10 REST on Apache?

I was (getting nothing but 404's for CF10 REST on Apache), and it baffled me for days. It turns out that the solution is incredibly simple.

In my case, I've got several Virtual Hosts setup in Apache, and the CF10 installer isn't accounting for this. All you have to do is add a line to each VHost for which you want to enable REST. The installer adds the line to the global httpd.conf file, but not to the included file that defines VHosts.

Not only is the separation of vhosts out into an include file standard on recent versions of OSX, it's pretty standard among most Apache installs these days. I imagine that pretty much all developers using Apache and multiple VHosts will run into this problem if and when they try to use the CF10 REST features.

If you're on OSX, it's probably something like this:

JkMountFile "/Applications/ColdFusion10/config/wsconfig/1/uriworkermap.properties"

Or on Windows, like this:

JkMountFile "C:\ColdFusion10\config\wsconfig\1\uriworkermap.properties"

So once added, my localhost VHost entry looked like this, with the new JkMountFile directive in the middle:

<VirtualHost *:80>

    ServerName localhost
    ServerAlias localhost
    DocumentRoot /Users/adam/Sites/localhost

    ErrorLog /private/var/log/apache2/localhost-error_log
    CustomLog /private/var/log/apache2/localhost-access_log common

    JkMountFile "/Applications/ColdFusion10/config/wsconfig/1/uriworkermap.properties"

    <Directory "/Users/Adam/Sites/localhost">
        Options Indexes FollowSymLinks
        AllowOverride AuthConfig FileInfo
        Order allow,deny
        Allow from all

        RewriteEngine On
        RewriteOptions Inherit
    </Directory>

</VirtualHost>

Simply save the file and restart Apache and you're on your way.

Credit for this information goes to the always wise and insightful Rob Brooks-Bilson.

I've filed a bug against the CF10 installer for this issue. I imagine it's possible that the issue is too nuanced to be able to fix for all users all of the time (or we may not have time to get it fixed before release), but regardless of whether or not the installer is fixed, the documentation needs to make this painfully clear.

1 response:

Thiago

Thiago

Thanks, very helpful!

Same problem and same solution on CF11 here.

Your comment:

Leave this field empty: