1

I have a Lucee app running in Commandbox in a Docker container on Centos 7.

Docker version 1.13.1, build 0be3e21/1.13.1
CentOS Linux release 7.9.2009 (Core)
Commandbox v5.2.1+00295
Lucee 5.3.7.47

The application code is copied to the /app directory at startup via the Dockerfile:

COPY . /app

I would like to view a dot file (hidden file) in the /app directory, /app/.build.

If I browse to http://app_name.com/.build, I get a 404 error (Not Found).

If I rename the file to build.json by the following command:

cp .build build.json

then I can view it via http://app_name.com/build.json

I've tried making the following entry in the server.json file:

"rewrites":{
    "enable":true,
    "config":"customRewrites.xml"
},

And the following rule in the customRewrites.xml file:

<rule>
    <from>\.build$</from>
    <set type="content-type">text-html</set>
    <to last="true">\.build</to>
</rule>

Adding the complete Dockerfile for more clarity:

FROM ortussolutions/commandbox
COPY . /app
COPY ./config/ /config/
ENV LUCEE_EXTENSIONS D4EDFDBD-A9A3-E9AF-597322D767E0C949;name=Oracle;version=11.2.0.4
WORKDIR $APP_DIR
RUN box install

After some further investigation, I found that the problem seems to be that the /usr/local/lib/serverHome/WEB-INF/urlrewrite.xml file is not being created at startup. The logs during startup indicate that the rewrites are being read: --urlrewrite-enable true --urlrewrite-file /app/customRewrites.xml

  • can you add the Dockerfile, please? – Omar Al-Howeiti Feb 26 '21 at 13:58
  • I added the complete Dockerfile for clarity, thanks for asking: – Randy Welling Feb 26 '21 at 15:17
  • did you executed this command `cp .build build.json` inside the docker container? I mean did you check that the file, `.build` copied into the docker container? – Omar Al-Howeiti Feb 27 '21 at 12:19
  • are u sure from the syntax of `customRewrites.xml` file? can you have a look [here](https://commandbox.ortusbooks.com/embedded-server/configuring-your-server/url-rewrites#custom-rules). – Omar Al-Howeiti Feb 27 '21 at 13:16
  • Omar, I did check that the files exist in the Docker container The current Docker container name is "d97aaa01fd38" root@d97aaa01fd38:/app# pwd /app root@d97aaa01fd38:/app# ls -la |grep build -rw-r--r--. 1 root root 152 Feb 23 21:15 .build -rw-r--r--. 1 root root 152 Feb 23 21:15 build.json – Randy Welling Mar 01 '21 at 14:40
  • Omar, I found that the server.json file and the customRewrite.xml file seem to be read during the startup from the following log entries: – Randy Welling Mar 01 '21 at 20:03
  • Omar, I found that the server.json file and the customRewrite.xml file seem to be read during the startup from the following log entries: | server config file - /app//server.json | --urlrewrite-enable true | --urlrewrite-file /app/customRewrites.xml However, the /usr/local/lib/serverHome/WEB-INF/urlrewrite.xml is not being generated. On other systems that I have customRewrites.xml files, the /usr/local/lib/serverHome/WEB-INF/urlrewrite.xml is generated at startup with the contents of the customRewrites.xml. – Randy Welling Mar 01 '21 at 20:11
  • okay what I mean... are u sure from the syntax of the customRewrites.xml rule for form tag? shoud u use the forwarded slash rather than backward slash? I think `\.build$` should look like this `
    ^/.build$
    `
    – Omar Al-Howeiti Mar 01 '21 at 20:47
  • Omar, I tried changing the "\" to "/", still doesn't work. We are using the "\" to escape the ".". Thanks again for your suggestions – Randy Welling Mar 02 '21 at 14:59

1 Answers1

0

What I have found that the urlRewrite.xml file that comes as a default in Commandbox 5.2 has the following code that blocks hidden files:

<rule>
    <condition type="request-uri" operator="equal">.*/\..*</condition>
    <from>^/(.+)$</from>
    <set type="status">404</set>
    <to type="passthrough" last="true">/404.html</to>
</rule>