tomcat icon indicating copy to clipboard operation
tomcat copied to clipboard

Symbolic links returning 404

Open sheen-justin opened this issue 1 year ago • 1 comments

Running into an issue where symbolic links in a mounted volume are served as 404. The symlinks are created and exist on the container itself, but the tomcat server does not seem to serve them as normal files and instead returns 404.

Here's a quick way to replicate this behavior:

docker-compose.yml

services:
    test-symlink:
        container_name: test-symlink
        image: tomcat
        ports:
            - "8080:8080"
        volumes:
            - ./app:/usr/local/tomcat/webapps/app
mkdir app
touch app/real-file.txt
ln -s real-file.txt app/symlink.txt
docker compose up

http://localhost:8080/app/real-file.txt > returns 200 http://localhost:8080/app/symlink.txt > returns 404

sheen-justin avatar May 16 '24 01:05 sheen-justin

I think you need to set the allowLinking attribute somewhere in the xml config files: https://tomcat.apache.org/tomcat-9.0-doc/config/resources.html

yosifkit avatar May 16 '24 16:05 yosifkit