On Mon, Aug 24, 2020 at 4:27 AM Mark Thomas <ma...@apache.org> wrote:
> On 23/08/2020 22:05, Aryeh Friedman wrote: > > In order to allow my developers to quickly access any temporarily > produced > > html files created/stored outside of webapps (such as those created by > the > > jacoco test coverage tool) I want to allow read only access to the root > > directory of the development server (firewalled and all access outside of > > the LAN is disabled) via tomcat. I can get it to do any directory > > *EXCEPT* / as the docBase but a docBase of "/" returns an empty dir > listing > > (which is obviously wrong): > > > > In config/web.xml: > > <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> > > That should be sufficient to enable directory listings for all web > applications. > > > In server.xml (this works): > > <Host name="localhost" appBase="webapps" > > unpackWARs="true" autoDeploy="true"> > > > > <!-- SingleSignOn valve, share authentication between web > > applications > > Documentation at: /docs/config/valve.html --> > > <!-- > > <Valve > className="org.apache.catalina.authenticator.SingleSignOn" /> > > --> > > > > <!-- Access log processes all example. > > Documentation at: /docs/config/valve.html > > Note: The pattern used is equivalent to using > pattern="common" > > --> > > <Valve className="org.apache.catalina.valves.AccessLogValve" > > directory="logs" > > prefix="localhost_access_log" suffix=".txt" > > pattern="%h %l %u %t "%r" %s %b" /> > > <Context docBase="/fakeRoot" path="/files"> > > </Context> > > I'd do this with a ROOT.xml file in > $CATALINA_BASE/conf/Catalina/localhost but the above should work. > > > But this does not work: > > <Context docBase="/" path="/files"> > > The docBase is not correct (it should be "") but Tomcat probably will > let you get away with that. > > Tried and it gives me /usr/local/apache-tomcat-9.0/webapps as the effective dir. This is *NOT* what I meant by the root dir I meant the one that is the highest point in the file system hierarchy (i.e. the one you get when at a shell prompt when you type "cd /") [this is for a Unix machine of course since Windows has no concept of such a directory/folder] > I tested this locally and it works as expected. > > Maybe a file permissions issue? > > Mark > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > -- Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org