Skip to content

404 errors when using CMD_URL_PATH in new 2.6.0 #1936

Open

Description

@esteveavi

Hello,

When configuring CMD_URL_PATH to some value 404 appears on internal resources like js, favicon, and the app is not working.

Here is an example of docker-componse:
services:
database:
image: postgres:11.6-alpine
environment:
- POSTGRES_USER=codimd
- POSTGRES_PASSWORD=change_password
- POSTGRES_DB=codimd
volumes:
- "database-data:/var/lib/postgresql/data"
restart: always
codimd:
build:
context: .
args:
- CMD_URL_PATH=codimd
image: nabo.codimd.dev/hackmdio/hackmd:2.6.0
environment:
- CMD_DB_URL=postgres://codimd:change_password@database/codimd
- CMD_USECDN=true
- CMD_URL_PATH=codimd
- CMD_DOMAIN=localhost
- CMD_PROTOCOL_USESSL=false
- CMD_URL_ADDPORT=true
depends_on:
- database
ports:
- "3000:3000"
volumes:
- upload-data:/home/hackmd/app/public/uploads
restart: always
volumes:
database-data: {}
upload-data: {}

http://localhost:3000/codimd/build/font.68d91a5a4c1afd7f82a9.css --> 404
http://localhost:3000/codimd/build/cover.65bca5da2232a62861ce.css |  --> 404
.....

Do I miss something?

Thanks

Activity

  1. modified the milestone: 2.6.1 on Aug 13, 2025
  2. Yukaii commented on Sep 30, 2025

    @Yukaii
    Member

    You should probably use a reverse proxy like nginx or Caddy to host your CodiMD application. Below is an example config:


    server {
        listen 80;
        server_name yourdomain.com;
    
        # Redirect root to /codimd/
        location = / {
            return 301 /codimd/;
        }
    
        # Redirect /codimd to /codimd/
        location = /codimd {
            return 301 /codimd/;
        }
    
        # Handle /codimd/* requests
        location /codimd/ {
            # Strip /codimd prefix before forwarding
            rewrite ^/codimd/(.*)$ /$1 break;
            
            proxy_pass http://codimd:3000;  # Your CodiMD container
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Prefix /codimd;
            
            # WebSocket support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }
    }
    
    # WebSocket upgrade map
    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions