hackmdio / hackmdio/codimd

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

Open
#1,440 10 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
10.1k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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  `` .

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)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.