Highlighted

Serving static files in ColdFusion

New Here ,
Nov 30, 2017

Copy link to clipboard

Copied

Hello,

I'm learning ColdFusion (have a background in web development) and have created a simple test site in ColdFusion Builder 2016. I run my site using the built in server, the one built into ColdFusion Builder 2016, runs locally on port 8600. I am trying to add my own custom CSS file, and ColdFusion can't seem to find it, keeps giving me a 404. It's a very simple CSS file with a very simple link tag:

<html>

     <head>

         <!-- Some code here... -->

         <link rel="stylesheet" type="text/css" href="footer.css" />

         <!-- Some more code here... -->

     </head>

     <!-- Rest of the code here... -->

Very simple and straightforward, but for the life of me I can't get ColdFusion to find the CSS file. Does ColdFusion not serve static content? I noticed I get the same problem with JS files, too. I've done a lot of googling and am not getting anywhere. It's not a permissions issue (tried chmod 777 and that didn't work). How can I serve static content?

Thanks!

Adobe Community Professional
Correct answer by Dave_Watts | Adobe Community Professional

I've never used the server instance built into ColdFusion Builder, but ColdFusion's built-in web server can certainly serve static content. My recommendation would be to just install the standalone version of ColdFusion with the developer license, and then you can use ColdFusion Builder or any other editor to work against that.

Dave Watts, CTO, Fig Leaf Software

Views

519

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Serving static files in ColdFusion

New Here ,
Nov 30, 2017

Copy link to clipboard

Copied

Hello,

I'm learning ColdFusion (have a background in web development) and have created a simple test site in ColdFusion Builder 2016. I run my site using the built in server, the one built into ColdFusion Builder 2016, runs locally on port 8600. I am trying to add my own custom CSS file, and ColdFusion can't seem to find it, keeps giving me a 404. It's a very simple CSS file with a very simple link tag:

<html>

     <head>

         <!-- Some code here... -->

         <link rel="stylesheet" type="text/css" href="footer.css" />

         <!-- Some more code here... -->

     </head>

     <!-- Rest of the code here... -->

Very simple and straightforward, but for the life of me I can't get ColdFusion to find the CSS file. Does ColdFusion not serve static content? I noticed I get the same problem with JS files, too. I've done a lot of googling and am not getting anywhere. It's not a permissions issue (tried chmod 777 and that didn't work). How can I serve static content?

Thanks!

Adobe Community Professional
Correct answer by Dave_Watts | Adobe Community Professional

I've never used the server instance built into ColdFusion Builder, but ColdFusion's built-in web server can certainly serve static content. My recommendation would be to just install the standalone version of ColdFusion with the developer license, and then you can use ColdFusion Builder or any other editor to work against that.

Dave Watts, CTO, Fig Leaf Software

Views

520

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 30, 2017 0
Adobe Community Professional ,
Nov 30, 2017

Copy link to clipboard

Copied

I've never used the server instance built into ColdFusion Builder, but ColdFusion's built-in web server can certainly serve static content. My recommendation would be to just install the standalone version of ColdFusion with the developer license, and then you can use ColdFusion Builder or any other editor to work against that.

Dave Watts, CTO, Fig Leaf Software

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2017 0
New Here ,
Nov 30, 2017

Copy link to clipboard

Copied

Hi Dave,

I do have a standalone version of ColdFusion, running locally, serving sites that my company has built. I went ahead and moved my test site into that environment, and it's working great now. Serving static files just fine.

That makes me wonder, though. Does the built-in CF server that comes bundled with CF Builder 2016 not serve static content? If not, why not? If it does, how? Moving this test app into the standalone version fixed my problem, but why? Why wouldn't the built-in server behave the same way?

Thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2017 0
Adobe Community Professional ,
Nov 30, 2017

Copy link to clipboard

Copied

My guess is that it has something to do with where files are actually located to serve. Again, I don't use CF Builder 2016, so this is all conjecture, but I do know that it's built from Eclipse. Eclipse has this concept of workspaces, which is where your actual files go (the ones you're editing). Eclipse is originally a Java IDE, and in Java, your source files go in one place (your workspace) and your deployed compiled code goes into another place (your J2EE app server). I don't know how the workspace functionality in CF Builder plays with the built-in web server.

Again, this is all conjecture on my part. Maybe someone will come along who actually knows. But I would still want to keep them separate anyway, if it's up to me.

Dave Watts, CTO, Fig Leaf Software

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2017 0
Adobe Community Professional ,
Nov 30, 2017

Copy link to clipboard

Copied

I realize this is somewhat moot since you have gone to using a full installer of CF, but in case someone else may be in your shoes, or if you want to dig a little further, I would have some thoughts to add on to Dave's helpful comments.

First, where in fact were you putting the CFML and the static files? Was it in the cfusion\wwwroot folder of the CF implementation that came with Builder? Or was it in some other folder? And were the CFM and static files in the same folder?

And how were you browsing the CFM page? using a browser, where you typed in a URL? If so, what URL?

And if instead you were using a browse/run feature within CFBuilder, had you opened the CFM file as part of a project before trying to do that? Or had you opened it using the file explorer instead? There's a big difference in how a CFM is handled by CFBuilder, depending on that choice. And that may have had a reflection in your challenge with static files.

Finally, whatever browser you were using (if not the built-in one in CFBuilder), you could have used the browser's "developer tools" to see (in the tool's "network" tab) what was happening about the request from the browser to the server. You'd see what URL it was using, and what status code and response it was getting.

Bottom line: there should be a solution to your problem, if you or other future readers ever want to dig in further.

/Charlie (server troubleshooter, carehart.org)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2017 0