Hello there!
I have an old codimd, I want to migrate it to HedgeDoc .
My version of HedgeDoc is: <1.10.0>
. I installed it by manual.
Then I want to use nginx as the proxy server, so I read this doc.
Here is my config
{
"test": {
"db": {
"dialect": "sqlite",
"storage": ":memory:"
},
"linkifyHeaderStyle": "gfm"
},
"development": {
"loglevel": "debug",
"db": {
"dialect": "sqlite",
"storage": "./db.hedgedoc.sqlite"
},
"domain": "dev-hedgedoc.dlll.nccu.edu.tw",
"urlAddPort": false,
"protocolUseSSL": true,
"UseSSL": false,
"sessionSecret": "CfALttnLLSmjF3,V",
"hsts": {
"enable": false
}
},
"production": {
"domain": "dev-hedgedoc.dlll.nccu.edu.tw",
"urlAddPort": false,
"UseSSL": false,
"protocolUseSSL": true,
"sessionSecret": "CfALttnLLSmjF3,V",
"loglevel": "info",
"hsts": {
"enable": true,
"maxAgeSeconds": 31536000,
"includeSubdomains": true,
"preload": true
},
"csp": {
"enable": true,
"directives": {
},
"upgradeInsecureRequests": "auto",
"addDefaults": true,
"addDisqus": true,
"addGoogleAnalytics": true
},
"cookiePolicy": "lax",
"db": {
"username": "codimd",
"password": "La2391!@2391",
"database": "codimd",
"host": "127.0.0.1",
"port": "3306",
"dialect": "mariadb"
},
"email":true,
"allowEmailRegister":true
}
}
And here is my nginx config
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
proxy_pass http://localhost:3000;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade-Insecure-Requests 1;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
location /socket.io/ {
proxy_pass http://localhost:3000;
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 Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
add_header Access-Control-Allow-Origin *;
proxy_pass http://localhost:3000;
}
location ~ .*/ {
proxy_pass http://localhost:3000;
}
}
My HedgeDoc instance works at https://dev-hedgedoc.dlll.nccu.edu.tw/
It seems to work. (It can even show the page migrated from codimd! )
But when I tried to login HedgeDoc, it redirected to home page.
“Register” button also showed same result.
What I expected to happen:
Login or register as normal(with email).
What actually happened:
When I pressed login or register button, it redirected to home page, without any message in browser.
In console, it show following message(login):
2024-10-08T08:06:21.914Z info: serializeUser: 03b0aab6-289f-435a-b145-286bf3767f31
2024-10-08T08:06:21.930Z info: 140.119.61.127 - - [08/Oct/2024:08:06:21 +0000] "POST /login HTTP/1.0" 302 120 "https://dev-hedgedoc.dlll.nccu.edu.tw/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
2024-10-08T08:06:21.966Z info: 140.119.61.127 - - [08/Oct/2024:08:06:21 +0000] "GET / HTTP/1.0" 304 - "https://dev-hedgedoc.dlll.nccu.edu.tw/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
2024-10-08T08:06:22.229Z info: 140.119.61.127 - - [08/Oct/2024:08:06:22 +0000] "GET /config HTTP/1.0" 304 - "https://dev-hedgedoc.dlll.nccu.edu.tw/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
2024-10-08T08:06:22.547Z info: 140.119.61.127 - - [08/Oct/2024:08:06:22 +0000] "GET /me HTTP/1.0" 304 - "https://dev-hedgedoc.dlll.nccu.edu.tw/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
I already tried:
(As a new user, I can’t turn following title to link.)
-
doc1 =>
Cant Login (Email)
in this community
According to this page , I setprotocolUseSSL
astrue
. -
doc2 =>
Login attempts just redirect to home page
in this community
According to this page , I commented outX-Forwarded-For
setting in nginx.
But it still doesn’t work, whever I commented outX-Forwarded-For
setting or not.) -
doc3 =>
Using nginx as a reverse proxy
in this community
But I already set that setting on nginxdefault
file. (Using a Reverse Proxy with HedgeDoc
doc) -
Use http
I setprotocolUseSSL
asfalse
, then accessed with http.
It worked as following screenshot(I had already setprotocolUseSSL
asfalse
after this post).
login with https(login success)
Notes in this page was migrated from old codimd.
But I still want to use https to access my HedgeDoc.
Is any thing I can do?
Thanks in advance!