Skip to content

docker image config to serve web files from subdir instead of root #1440

Open
@aleqx

Description

@aleqx

I want to use the Docker installation rather than manual installation (docker-compose image works fine, no problem accessing it under port 3000) but I want to change CodiMD's web installation folder from root to a subdir, i.e. from  http://localhost:3000/  to  http://localhost:3000/codimd -- is that possible? Any pointers?

Right now I notice the html content points to absolute urls such as  <img src="/screenshot.png" /> .

I take it I'd need to edit the docker image to change the internal web server's config to serve the static files at the /codimd url instead of at /, and then also set CMD_URL_PATH=codimd in the docker env variables.

  • Setting only CMD_URL_PATH=codimd does changes the html output of localhost:3000/ and shows broken images and css, there is nothing at localhost:3000/codimd

  • Setting only CMD_URL_PATH=codimd and also changing app.js to read app.use('/codimd', express.static(path.join(__dirname, '/public'), { maxAge: config.staticCacheTime, index: false })) ends up in a redirect loop between /codimd/ and /codimd` (not the missing trailing slash)

I'd be grateful for some more exact pointers on how to do this.

The end goal is to put the CodiMD docker under a proxypass such that mydomain.com/codimd proxy-passes to localhost:3000/codimd (I can do a few things by rewriting html output, but that's not cutting it, as some CSS would also need to, it would be just cleaner to have CodiMD installed in a web subdir)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions