April 9, 2018
Cannot get ColdFusion to follow Symlinks…
Comments
(8)
April 9, 2018
Cannot get ColdFusion to follow Symlinks…
Newbie 1 posts
Followers: 0 people
(8)

So I have two websites…  www.mydomain.com  and myapp.mydomain.com.  The www. site is located in the C:/Inetpub/wwwroot folder.  The myapp. site is located in the C:/Inetpub/wwwroot/myapp folder.  IIS serves both websites perfectly.  (I’m running IIS on Windows Server 2012 R2, btw).

The problem I’m having is that both sites need to access the C:/Inetpub/wwwroot/myCfFiles folder.  The www. site, of course, sees the myCfFiles as a subfolder so www.mydomain.com/myCfFiles will let me access my CF files…  But the myapp. site cannot see C:/Inetpub/wwwroot/myCfFiles, because it sees C:/Inetpub/wwwroot/myapp as its root, and cannot access up one level to then go down a level into myCfFiles.

So in the myapp. site, I created a symlink by going into the C:/Inetpub/wwwroot/myapp folder and typing:
‘mklink /D myCfFiles C:/Inetpub/wwwroot/myCfFiles’
which created a directory link from C:/Inetpub/wwwroot/myapp/myCfFiles to C:/Inetpub/wwwroot/myCfFiles.

If, in a web-browser, I type  myapp.mydomain.com/myCfFiles, IIS will serve up an index.html file if I put one in there.  Any file, other than a ColdFusion file, will work fine in there.

When I try to read a ColdFusion file in there, I get a 404-file-not-found error.  Clearly, ColdFusion is not following the symlink.

So here’s my question — how do I make ColdFusion 11 follow symlinks?

Thanks,
L.

 

8 Comments
2018-04-10 16:49:15
2018-04-10 16:49:15

Fixed!!

I had to create two virtual directories in IIS inside my “myapp” site. One that points “/CFIDE” to C:/ColdFusion11/cfusion/wwwroot/CFIDE and one that points “/jakarta” to “C:/ColdFusion11/config/wsconfig/1”

Those virtual directories existed in my main “www” site, but not in the new “myapp” site.

So I was completely misinterpreting the issue — I thought it was a symlink issue, but I had never tested *any* ColdFusion code in the myapp.mydomain.com site… Sorry ’bout that.

So for future reference, when you create a new site in IIS, be sure to add the CFIDE and jakarta virtual directories inside that site in IIS. 🙂

Thanks for pointing me in the right direction. Messing with the IIS settings and the test.cfm stuff got me looking where I needed to look to find the solution.

Thanks!
L.

Like
(1)
>
Laurence MacNeill
's comment
2018-04-10 20:06:55
2018-04-10 20:06:55
>
Laurence MacNeill
's comment

Glad you solved it, L. But to be clear, you would have found this sooner had you heeded my first suggestion:

“First, are you running the page from the server itself? If not you may find that you did, you may see more detail (this is default behavior in IIS, per the “error pages” feature at the site level, and its “edit feature settings” option about when “custom” vs “detailed” errors are shown, for “local” vs “remote” requests).

Some errors that will show more detail when browsed from the server may end up appearing simply as 404 pages to an end user requesting the same page from OFF the server.”

My point was that you would have seen then WHATEVER error it was. I was tempted to ask if you had in fact only recently created the site, and had remembered to put in the jakarta VD (IIS can’t put that in for us, the way it propagates the ISAPI Filter and Handler Mappings set at the server level by CF when you told it to connect “all sites” initially. We have to add that VD ourselves.)

But you could have had still other problems, so having you see the “real error” by browsing on the server seemed the most expedient suggestion for all concerned. You may want to try that, before moving on, to see what I mean.

But anyway, glad you solved your problem.

Like
2018-04-10 16:15:59
2018-04-10 16:15:59

A new wrinkle!!

If I create a ‘test’ folder inside the C:\Inetpub\wwwroot\myapp folder, then browse to myapp.mydomain.com/test/test.cfm I get the same 404-file-not-found error. No symlinks, no virtual directories, and still a file-not-found error…

So… It appears that ColdFusion doesn’t like the myapp.domain.com site at all. Why is it not serving files to that site?

Thanks,
L.

Like
2018-04-10 13:01:16
2018-04-10 13:01:16

L, I think you will find that this is not a symlink problem. CF CAN run page pointed to via a symlink (created using mklink, for those not familiar with that DOS command, from recent years).

Instead, I would suggest that the 404 error you see may just be masking some other problem.

First, are you running the page from the server itself? If not you may find that you did, you may see more detail (this is default behavior in IIS, per the “error pages” feature at the site level, and its “edit feature settings” option about when “custom” vs “detailed” errors are shown, for “local” vs “remote” requests).

Some errors that will show more detail when browsed from the server may end up appearing simply as 404 pages to an end user requesting the same page from OFF the server.

Another tip/sanity check would be to create a new “test” folder under your mycfmfiles folder, and in that folder put a blank test.cfm and blank application.cfm file, then browse that mycfmfiles/test/test.cfm. Does it work? If so, then that tells you that the problem is again now about symlinks but rather some error in your “real” app. You might get the 404 again (or whatever “real” error you were getting when making the request “on the server”.)

As you (and future readers) may know, the blank application.cfm is a trick that tells CF not to look for any such file in parent folders. So if this /mycmfiles/test/test.cfm works, it tells us the problem is in some ancestor application.cfm or cfc.

Let us know how things go.

Oh, and as I was writing this, I see Mike chimed in about using an IIS virtual directory. Yep, that is indeed a reasonable alternative to your use of a symlink. Perhaps you have a Linux background and didn’t know that IIS provides for this. Of course, symlinks are at the OS level (Mike said “jvm” level, but I think he meant to say OS level), and VDs are used only by IIS. But for your need, it seems a VD alone should suffice.

Still, if you try it, and find that that doesn’t “fix” the problem, I will again point to what I propose above. (And I really don’t expect it to “fix” the problem because again I can confirm that CF has no problem rendering CFM files found in such a symlink folder.)

Again, let us know how it all goes.

Like
(1)
>
Charlie Arehart
's comment
2018-04-10 16:01:44
2018-04-10 16:01:44
>
Charlie Arehart
's comment

Ok… In the meCfFiles folder, I created a ‘test’ folder, and inside that folder I created a blank application.cfm and a blank test.cfm file.

When I browse to http://www.mydomain.com/myCfFiles/test/test.cfm I get a blank screen, as expected.

When I browse to myapp.mydomain.com/myCfFiles/test/test.cfm I still get the 404-file-not-found error.

So it’s clearly something inside ColdFusion that’s not letting it browse a link, no?

Like
2018-04-10 12:45:20
2018-04-10 12:45:20

Have you tried using a Virtual directory on the myapp site – mapping myCfFiles to C:/Inetpub/wwwroot/myCfFiles. Symlink issues are at the JVM level CF just relies on the JVM for file access.

Like
(2)
>
Mike Collins_CF
's comment
2018-04-10 16:03:10
2018-04-10 16:03:10
>
Mike Collins_CF
's comment

So from inside the web-site settings for the myapp. site, I just create a virtual ‘myCfFiles’ folder and do it that way instead of using an OS-level symlink… Hmmm… I will give that a shot… Hopefully that’ll work.

Thanks,
L.

Like
>
Laurence MacNeill
's comment
2018-04-10 16:09:40
2018-04-10 16:09:40
>
Laurence MacNeill
's comment

Nope. Didn’t work.

I deleted the symlink. Opened IIS. Right clicked on the “myapp” site, and selected “Add Virtual Directory”. Set the alias to “myCfFiles’ and the physical path to “C:\Inetpub\wwwroot\myCfFiles”.

I get the same results as I had before. http://www.mydomain.com/myCfFiles/test/tes.cfm works fine, and myapp.mydomain.com/myCfFiles/test/test.cfm gives me 404=file-not-found.

BTW, If I create an index.html in that test folder, IIS serves it up fine. It’s just the CFM files that are giving me a problem… Very weird.

Thanks,
L.

Like
Add Comment