portal entry

select a category, or use search below
(searches all categories and all time range)
Title:

Cannot get ColdFusion to follow Symlinks…

| View in Portal
April 09, 2018 09:03:09 PM GMT
8 Comments
<p>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 […]</p>
<p>The post <a rel="nofollow" href="https://coldfusion.adobe.com/2018/04/cannot-get-coldfusion-to-follow-symlinks/">Cannot get ColdFusion to follow Symlinks…</a> appeared first on <a rel="nofollow" href="https://coldfusion.adobe.com">ColdFusion</a>.</p>
Labels: ColdFusion, Discussion, Language, 11, 2012, coldfusion 11, language, mklink, r2, server, symlink, troubleshooting, windows, windows server 2012 r2

Comments:

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.
Comment by Mike Collins
98 | April 10, 2018 12:45:20 PM GMT
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.
Comment by Charlie Arehart
97 | April 10, 2018 01:01:16 PM GMT
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 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?
95 | April 10, 2018 04:01:44 PM GMT
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.
94 | April 10, 2018 04:03:10 PM GMT
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. 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.
93 | April 10, 2018 04:09:40 PM GMT
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.
92 | April 10, 2018 04:15:59 PM GMT
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.
91 | April 10, 2018 04:49:15 PM GMT
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.
Comment by Charlie Arehart
90 | April 10, 2018 08:06:55 PM GMT