hackmdio / codimd

CodiMD - Realtime collaborative markdown notes on all platforms.
https://hackmd.io/c/codimd-documentation
GNU Affero General Public License v3.0
9.24k stars 1.05k forks source link

A guest opening a limited note gets an internal server error #1810

Closed fbarco closed 1 year ago

fbarco commented 1 year ago

When using hackmd 2.3.2 docker image, a guest opening a limited notes is redirected to the index page with this message : You are not allowed to access this page. Maybe try logging in? If we upgrade the docker image to 2.4.1 or 2.4.2, it is redirected to an Internal server error? It is the same with these permissions :

jackycute commented 1 year ago

Hi @fbarco, Thanks for reporting here. I think the error you see is this:

截圖 2023-06-15 下午8 48 28
TypeError [ERR_INVALID_URL]: Invalid URL: 
    at onParseError (internal/url.js:259:9)
    at new URL (internal/url.js:335:5)
    at new URL (internal/url.js:332:22)
    at errorForbidden (/Users/maxwu/codimd/lib/response.js:35:19)
    at showNote (/Users/maxwu/codimd/lib/note/index.js:71:12)

You can see the full error when running in NODE_ENV=development. This was introduced in https://github.com/hackmdio/codimd/commit/7d815cc90c31a8ad8964b5fceddea5080b5e44b2 And to avoid this, please properly give CMD_DOMAIN in your env var so the redirect url can be generated. Hope this helps.

fbarco commented 1 year ago

Hi @jackycute , Thanks a lot for your answer. That's what we did, but without CMD_PROTOCOL_USESSL=true. Now with these two environment variables, it's OK. Regards