Case insensitive path lookup

1. Caddy version (caddy version):

2.4.3

2. How I run Caddy:

I run caddy in a docker container with a connection to a Umbraco instance.

a. System environment:

Docker

b. Command:

docker-compose up -d

c. Service/unit/compose file:

version: "3.8"

services:
    umbraco-db:
      image: mcr.microsoft.com/mssql/server:latest
      user: root
      env_file: ./configs/ms.sql.env
      volumes:
        - umbraco.db:/var/opt/mssql/data
      restart: always
      ports:
        - '3930:1433'
        - '3931:1434'
    
    umbraco:
      restart: always
      depends_on:
        - umbraco-db
      build:
        context: .
        dockerfile: Dockerfile
      entrypoint: ["./wait-for-it.sh", "host.docker.internal:3930", "-t", "120", "--", "dotnet", "Web.Umbraco.dll"]
      volumes: 
        - umbraco.media:/app/wwwroot/media
        - ./src/Web.Umbraco/Views:/app/Views
        - ./src/Web.Umbraco/uSync:/app/uSync
  
    caddy:
      image: caddy:latest
      restart: unless-stopped
      ports: 
        - "81:81"
        - "433:433"
      volumes: 
        - ./Caddyfile:/etc/caddy/Caddyfile
        - ./site:/server
        - caddy_data:/data
        - caddy_config:/config

volumes:
    umbraco.db:
    umbraco.media:
    caddy_data:
    caddy_config:

d. My complete Caddyfile or JSON config:

localhost:81 {
    reverse_proxy umbraco:80
}

3. The problem I’m having:

I’m having problems with URLs with uppercase letters when the URL is referring to a file. For example https://localhost:81/umbraco/views/propertyEditors/grid/dialogs/layoutconfig.html will send a 404 not found error when https://localhost:81/umbraco/views/propertyeditors/grid/dialogs/layoutconfig.html will find the file, therefore, I’m wondering if it’s possible to make a case-insensitive lookup so I don’t have to manually rewrite each problematic URL.

I don’t think anything built into Caddy can do this, but this sort of thing would be trivial to implement as a plugin for yourself:

1 Like

Sadly I don’t know any go and therefore have a hard time with understanding what to do. I also figured out that force lowercasing the path wouldn’t solve my problem because not all my files are located in lowercase directories. So I would actually need a case-insensitive lookup.

1 Like

You’ll need to solve that at your application level, really.

1 Like

Some file systems are case insensitive, you could try that.

But the best solution imo is to have properly cased URIs (e.g. don’t href to the wrong cases).

This topic was automatically closed after 30 days. New replies are no longer allowed.