3

I have a question related to CommandBox setup. I use latest version of ColdFusion and my folder structure looks like this:

D:/CommandBox/wwwroot

Inside of the wwwroot folder I created index.cfm file. That file contains only one line of code:

<cfoutput>#now()#</cfoutput>

Once I run this in my browser this is the url I use:

http://127.0.0.1:8080/

The result output is the error message that I see in the browser:

Forbidden

If I use this url code will produce the correct output:

http://127.0.0.1:8080/index.cfm

I would like to know why index.cfm has to be included in url? Is there a way to set index.cfm to be default landing page? Also, I found in my root folder C:\Users\myusername\.CommandBox\server\D9F80673BC7799BE959B513656FE8F55-CommandBox\lucee-5.3.6.61\WEB-INF file web.xml that contains this code:

<!-- default file to execute if directory is called with no file name, e.g. http://yourip.com/ !-->
  <welcome-file-list>
    <welcome-file>index.cfm</welcome-file>
    <welcome-file>index.lucee</welcome-file>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
  </welcome-file-list>

As you can see per comment above the code this should be default landing page. If anyone knows the reason and solution for this issue please let me know. Thanks.

espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
  • Which web server are you using? The default document needs to be set for your web server to handle. – Miguel-F Feb 12 '21 at 13:45
  • 2
    Does this answer your question? [Lucee Not Serving index.cfm By Default](https://stackoverflow.com/questions/44699532/lucee-not-serving-index-cfm-by-default) – Miguel-F Feb 12 '21 at 13:47
  • 1
    @Miguel-F That's exactly what I was looking for. The issue was that `index.cfm` didn't exist in my root folder. I added `index.cfm`, but that didn't solve the problem. At that time CommandBox was running. After I stopped CommandBox and then start again the problem was solved. If I enter 127.0.0.1:8080 the `index.cfm` content was displayed in the browser. Thank you. – espresso_coffee Feb 12 '21 at 14:02
  • Glad that helped. – Miguel-F Feb 12 '21 at 14:04
  • 1
    You should write that up as the solution so that the next person will have an anwser. I also note that it is different than the existing Lucee solution. – James A Mohler Feb 12 '21 at 17:01
  • @JamesAMohler I will do that. Thank you. – espresso_coffee Feb 12 '21 at 23:16
  • Did something change in your CommandBox setup? I thought CB handled `index.cfm` correctly by default. Is your server root pointing to that folder? For future readers, `FORBIDDEN` is a somewhat specific HTTP error, pretty much meaning `"I heard you and understood, but not gonna let you do it."` Essentially, a permissions thing. On our webservers, we've locked down to return `403: Forbidden` for naked url requests (no file, just domain). If the file didn't exist, I believe you would have got a `404: Not Found`. CommandBox must do some magic to reset that default document if the file's found. – Shawn Feb 16 '21 at 19:02
  • @Shawn I didn't change anything in my CommanBox setup. All I did was creating `index.cfm` in my `wwwroot` folder. After the CommandBox reboot the url was loading `index.cfm` file by default. – espresso_coffee Feb 16 '21 at 20:51
  • 1
    @espresso_coffee Interesting. Might be a question worth posting to Ortus or on the Slack. The `FORBIDDEN` error that got passed back is different than what I would expect for a missing file, but makes sense if the webserver doesn't know how to interpret naked urls. Regardless, glad you got it fixed. – Shawn Feb 17 '21 at 06:28

2 Answers2

4

The solution that I found for the issue above was next.

 1. First step in this process is to create index.cfm file inside your
    root folder (CommandBox/wwwroot)
    
 2. Stop the CommandBox
    
 3. Start CommandBox again
    
 4. Entered this url in your browser: 127.0.0.1:8080 (you can replace 8080 with your port number)
Shawn
  • 4,758
  • 1
  • 20
  • 29
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
0

There has to be index.html or index.cfm file in root folder, make sure you are not missing both.

simo
  • 23,342
  • 38
  • 121
  • 218