display directory contents instead of error

200 views
Skip to first unread message

DMan

unread,
Feb 23, 2015, 5:17:42 PM2/23/15
to lu...@googlegroups.com
I don't have an index.cfm in my vhost directory nor do I want one. So when I browse to the directory I get 

 Error (missinginclude)
MessagePage /index.cfm [/Users/x/Sites/xxxx/xxxx/index.cfm] not found

which is understandable.

How do I turn on directory listings?

Thanks in advance.

Jon Clausen

unread,
Feb 23, 2015, 5:38:14 PM2/23/15
to lu...@googlegroups.com
If your lucee install is running on Tomcat, adjust this setting in web.xml:

<init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value>
</init-param>

Most of the embedded Lucee and Railo servers I’ve used have directory listing on by default, though.  Is there possibly an include call in your Application.cfc onRequest() method?

--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/0ee5e239-1b11-44d0-9c4b-8e1dca70d72e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted
Message has been deleted

DMan

unread,
Feb 23, 2015, 5:53:15 PM2/23/15
to lu...@googlegroups.com
Thanks John.

Lucee express has this off by default. I want this setting server wide hence I'd like to set it once for all sites and not per Site.

I've modified that to true like below:

servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

Restarted Lucee but still I get an error as Tomcat is looking for index.cfm :(

Jon Clausen

unread,
Feb 23, 2015, 5:58:50 PM2/23/15
to lu...@googlegroups.com
Do you have any rewrite rules in place which might be directing 404 traffic to index.cfm or a custom 404 handler looking for that file?

[Note: Typo assistance courtesy of iPhone]
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

DMan

unread,
Feb 23, 2015, 6:00:29 PM2/23/15
to lu...@googlegroups.com
Nope nothing, a vanilla Lucee install with just a couple of vhosts in server.xml

Jordan Michaels

unread,
Feb 23, 2015, 6:39:01 PM2/23/15
to lu...@googlegroups.com
https://tomcat.apache.org/tomcat-7.0-doc/config/context.html

Use the "resourceOnlyServlets" attribute.

Warm Regards,
Jordan Michaels

On 02/23/2015 03:00 PM, DMan wrote:
> Nope nothing, a vanilla Lucee install with just a couple of vhosts in
> server.xml
>
>
> On Monday, February 23, 2015 at 10:58:50 PM UTC, Jon Clausen wrote:
>
> Do you have any rewrite rules in place which might be directing 404
> traffic to index.cfm or a custom 404 handler looking for that file?
>
> [Note: Typo assistance courtesy of iPhone]
>
> On Feb 23, 2015, at 5:53 PM, DMan <roo...@gmail.com <javascript:>>
> wrote:
>
>> Thanks John.
>>
>> Lucee express has this off by default. I want this setting server
>> wide hence I'd like to set it once for all sites and not per Site.
>>
>> I've modified that to true like below:
>>
>> servlet>
>> <servlet-name>default</servlet-name>
>>
>> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
>> <init-param>
>> <param-name>debug</param-name>
>> <param-value>0</param-value>
>> </init-param>
>> <init-param>
>> <param-name>listings</param-name>
>> <param-value>true</param-value>
>> </init-param>
>> <load-on-startup>1</load-on-startup>
>> </servlet>
>>
>> Restarted Lucee but still I get an error as Tomcat is looking for
>> index.cfm :(
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Lucee" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to lucee+un...@googlegroups.com <javascript:>.
>> To post to this group, send email to lu...@googlegroups.com
>> <javascript:>.
>> <https://groups.google.com/d/msgid/lucee/d6c6a1cd-c9e8-4e46-b27e-ebfc82dafd09%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Lucee" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to lucee+un...@googlegroups.com
> <mailto:lucee+un...@googlegroups.com>.
> To post to this group, send email to lu...@googlegroups.com
> <mailto:lu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/lucee/1712de6e-b8cd-44b6-8d0c-ac83e9fc2daf%40googlegroups.com
> <https://groups.google.com/d/msgid/lucee/1712de6e-b8cd-44b6-8d0c-ac83e9fc2daf%40googlegroups.com?utm_medium=email&utm_source=footer>.

Michael Offner

unread,
Feb 24, 2015, 2:12:55 AM2/24/15
to lu...@googlegroups.com
You can also do a listening in your application.cfc in the onMissingTemplate method...

Micha
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/0ee5e239-1b11-44d0-9c4b-8e1dca70d72e%40googlegroups.com.

Raymond Camden

unread,
Jul 20, 2016, 6:27:24 PM7/20/16
to Lucee
I'm trying to do this now with Lucee 5 Express - any clue as to actually use how to use the attribute? I can't find this as an existing setting anywhere.

Joseph Gooch

unread,
Jul 21, 2016, 10:26:35 PM7/21/16
to Lucee
Modify the listings param for defaultservlet in conf/web.xml to true
Modify conf/context.xml

<Context resourceOnlyServlets="LuceeServlet,CFMLServlet">

(Note those are the servlet names from conf/web.xml)

That will probably do it for you... I got a directory index on mine.

However... It also breaks virtual url type things and CGI.PATH_INFO type things.

i.e. I don't think /index.cfm/some/page will work anymore.

To get that back you may want to incorporate something like this:

or this filter:

-G

Raymond Camden

unread,
Jul 22, 2016, 8:26:15 AM7/22/16
to lu...@googlegroups.com
No go. I even tried adding default:

<Context docBase="/Users/raymondcamden/Dropbox/websites/testingzone"
resourceOnlyServlets="LuceeServlet,CFMLServlet,default">

(As an aside, docBase does nothing either, but one problem at a time. ;)

Joseph Gooch

unread,
Jul 22, 2016, 8:37:17 AM7/22/16
to lu...@googlegroups.com
I don't think docBase is honored in conf/context.xml.  (otherwise all your web contexts would have the same directory)

Copy conf/context.xml to conf/Catalina/localhost/ROOT.xml

I bet it'll magically work then.
-G


--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---

You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/CAK2avF8dGuS7w2xhAeLKvYwpa-HkbyKPUqLmN2i5Z2-GQDejmA%40mail.gmail.com.

Harry Klein

unread,
Jul 22, 2016, 8:37:57 AM7/22/16
to lu...@googlegroups.com
Did you deactivate/change the welcome-file-list in conf/web.xml too?

<!--
<welcome-file-list>
<welcome-file>index.cfm</welcome-file>
</welcome-file-list>
-->

-Harry

-----Ursprüngliche Nachricht-----
Von: lu...@googlegroups.com [mailto:lu...@googlegroups.com] Im Auftrag von Raymond Camden
Gesendet: Freitag, 22. Juli 2016 14:26
An: lu...@googlegroups.com
Betreff: Re: [Lucee] display directory contents instead of error
--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/CAK2avF8dGuS7w2xhAeLKvYwpa-HkbyKPUqLmN2i5Z2-GQDejmA%40mail.gmail.com.

Raymond Camden

unread,
Jul 22, 2016, 8:39:24 AM7/22/16
to lu...@googlegroups.com
Ah, that fixed docBase. Thank you! I still can't browse directories though. :)
> You received this message because you are subscribed to a topic in the
> Google Groups "Lucee" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/lucee/ivoCv0Hn4dM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> lucee+un...@googlegroups.com.
> To post to this group, send email to lu...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/lucee/CAKY58c5s6RDLdnsO46f6agxbVpTzHLBAHBK3bNE8pcJNGamJGw%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
===========================================================================
Raymond Camden, Developer Advocate for StrongLoop at IBM

Email : raymon...@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

Raymond Camden

unread,
Jul 22, 2016, 8:40:51 AM7/22/16
to lu...@googlegroups.com
And that fixed it. But to be clear, that 'feels' wrong to me. What I
mean is, given a request to /, I'd want Lucee to load
index.cfm/index.html *if it exists*, and if not, show a listing. Does
this change break that?
> You received this message because you are subscribed to a topic in the Google Groups "Lucee" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/lucee/ivoCv0Hn4dM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to lucee+un...@googlegroups.com.
> To post to this group, send email to lu...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/683ca7f10b994d1c81cd9288222f0da0%40srv-dc3.contens.local.
> For more options, visit https://groups.google.com/d/optout.



Harry Klein

unread,
Jul 22, 2016, 8:43:59 AM7/22/16
to lu...@googlegroups.com
Yes this change will always list directories, even if index.cfm exists. Which is fine for me in development.
Unfortunately I am not aware of a more "intelligent" solution which only lists directories if the defined "welcome-file" is not found.

-Harry

-----Ursprüngliche Nachricht-----
Von: lu...@googlegroups.com [mailto:lu...@googlegroups.com] Im Auftrag von Raymond Camden
Gesendet: Freitag, 22. Juli 2016 14:41
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/CAK2avF8w9APBXkeTbs9ChSmdEjKZOsjougfDqrPo0cQBBxnNMQ%40mail.gmail.com.

Joseph Gooch

unread,
Jul 22, 2016, 8:49:17 AM7/22/16
to lu...@googlegroups.com
Having to remove it from welcome-files is the behavior that resourceOnlyServlets *should* fix....

Here's my context.xml (copied to ROOT.xml) and web.xml for comparison

I'm testing with a directory that doesn't have an index.cfm or index.lucee. (or index.anything)

I also have the Search Friendly URLs filter in there to preserve that behavior.


context.xml
web.xml

Raymond Camden

unread,
Jul 22, 2016, 9:06:22 AM7/22/16
to lu...@googlegroups.com
For now - I'm happy - I got my doc root changed and directory listings
on. I'd like it to auto load index.cfm too (when it exists), but I can
live without it. This is just for my laptop, not production.

Thank you to everyone. :)
> https://groups.google.com/d/msgid/lucee/CAKY58c4%2Bq%3D7J5JiYbhxY89d1nbEYiBe66AawRXUJ1Hi_vK%2BH5g%40mail.gmail.com.

Joseph Gooch

unread,
Jul 22, 2016, 9:10:16 AM7/22/16
to lu...@googlegroups.com
So to summarize what I've seen for posterity :)

Options are:
1) Set listings=true in the defaultservlet. Remove index.cfm (and index.lucee) from welcome-files.   This gives directory listings, but doesn't auto-load index.cfm files.  index.cfm/anypath type links should still work.
2) Set listings=true in the defaultservlet. set resourceOnlyServlets to LuceeServlet,CFMLServlet.  Implement another solution for SES urls - tuckey's urlrewrite or OpenBD's SES filter or something else.
3) Write your own directory listing support via onMissingMethod in Application.cfc

Arguably, this should probably be easier out of the box with Lucee Express :) I'll submit a JIRA.  It might be worth including the tuckey urlrewrite filter in lucee express as it has other benefits/potential use cases.


-G



Harry Klein

unread,
Jul 22, 2016, 9:14:56 AM7/22/16
to lu...@googlegroups.com

Thanks Joseph, I never heard about „resourceOnlyServlets“.

I tried approach 2) but it didn’t work for me – is the SearchEngineFriendlyURLFilter required?

 

The only changes I did:

resourceOnlyServlets="CFMLServlet" (I deactivated the Lucee servlet)

and

uncomment the welcome-files.

 

-Harry

Joseph Gooch

unread,
Jul 22, 2016, 12:55:49 PM7/22/16
to lu...@googlegroups.com
Interesting, it didn't seem to work for Raymond either. You did the resourceOnlyServlets in conf/context.xml (or conf/Catalina/localhost/ROOT.xml)?

Not sure why it's working for me.  Is there something else different in my files vs yours?

SearchEngineFriendlyURLFilter is only necessary for SES urls. (i.e. /index.cfm/this/is/a/website)  Because no file named website in a path called /index.cfm/this/is/a/ exists.  (so resourceOnlyServlets will prevent the mapping from being issued against CFMLServlet)

The filter internally rewrites the above request as /index.cfm with a PATH_INFO of /this/is/a/website before mappings occur.

-G





Harry Klein

unread,
Jul 25, 2016, 3:42:22 AM7/25/16
to lu...@googlegroups.com

I added resourceOnlyServlets in „conf/context.xml“ – is this the right place?

Reply all
Reply to author
Forward
0 new messages