Copy link to clipboard
Copied
Hello, everyone.
Hypothetical scenario.
Say I wanted to have a file that would set globally accessible variables for containing passwords, and I want to place said file outside of web root, so users cannot access it.
Logical paths obviously won't work. And the cfinclude tag doesn't use physical paths.
I've never done this, before. What are my options?
Thank you,
^_^
Almost all your CFML files should not be in a web-browseable directory! Only the ones people actually browse to should be web accessible.
Files do not need to be web accessible to be <cfinclude>-ed or be instantiated as objects, or used as a custom tag.
EG:
C:\webapps\myapp <= this dir is the root as far as ColdFusion is concerned
C:\webapps\myapp\wwwroot <= that dir is the webroot as far as the web server goes
C:\webapps\myapp\includes <= files you <cfinclude>
C:\webapps\myapp\api <= CFCs
The only st
...Copy link to clipboard
Copied
Almost all your CFML files should not be in a web-browseable directory! Only the ones people actually browse to should be web accessible.
Files do not need to be web accessible to be <cfinclude>-ed or be instantiated as objects, or used as a custom tag.
EG:
C:\webapps\myapp <= this dir is the root as far as ColdFusion is concerned
C:\webapps\myapp\wwwroot <= that dir is the webroot as far as the web server goes
C:\webapps\myapp\includes <= files you <cfinclude>
C:\webapps\myapp\api <= CFCs
The only stuff that should be in that wwwroot dir is files people actually browse to (index.cfm, etc), and asset files like images, JS and CSS which need to be served to the browser.
The bulk of your CFM files should be in a subdir of C:\webapps\myapp.
So index.cfm needs to be browseable, and it needs to use the data in secretSecureStuff.cfm which is in the includes dir. So index.cfm just has:
include "/myapp/includes/secretSecureStuff.cfm";
If the file to be included isn't in the myapp subdir structure for whatever reason, then you can create a mapping in CFAdmin or Application.cfc to point to it, eg:
/external => C:\stuff\somewhere\else
And you'd reference C:\stuff\somewhere\else\outside.cfm via:
include "/external/outside.cfm";
--
Adam
Copy link to clipboard
Copied
Thanks, Adam. I have very little experience with CF Admin, but I think I can muddle through setting up a mapping for includes.
^_^
Copy link to clipboard
Copied
Thanks, Adam. I have very little experience with CF Admin, but I think I can muddle through setting up a mapping for includes.
Well don't forget you can do your mappings in Application.cfc too.
But, that said, you should be up to speed with CFAdmin, so it looks like here's an opportunity to start lookin'! 😉
Obviously sing-out if you get stuck (that'd be a different thread though, yeah?)
--
Adam
Copy link to clipboard
Copied
Okay.. starting another thread.
Copy link to clipboard
Copied
Custom tags and cfc's can be set up outside the webroot. You have to specify the location in CF Admin.
Copy link to clipboard
Copied
Dan Bracuk wrote:
Custom tags and cfc's can be set up outside the webroot. You have to specify the location in CF Admin.
Or in Application.cfc.
Everything that Adam already said.
jason