mrvautin / openKB

Open Source Nodejs Markdown based knowledge base (FAQ) app
https://openkb.markmoffat.com
MIT License
653 stars 199 forks source link

Permalink shows as http://localhost/xxxxxxxx #224

Open dsun29 opened 6 years ago

dsun29 commented 6 years ago

I have the openkb application in a docker container and in Nginx.conf I have

location / {
                proxy_pass http://localhost:4444;
        }

I guess it is the reason that permalink shows as http://localhost/xxxxxxx when it should be https://fullstax.xyz/xxxxxxxx. How can we correct it?

savikko commented 6 years ago

Dont know if the problem is nginx conf or openKb conf but my nginx conf (serving https) looks like this:

server {
        server_name hostname.example.com;
        listen 80;
        location / {
                return 301 https://$server_name$request_uri;
        }
}

server {
    listen 443 ssl;
    server_name hostname.example.com;
       ssl_certificate /path/hostname.crt;
       ssl_certificate_key /path/hostname.key;
       ssl_session_timeout 5m;
       ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
       ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
       ssl_prefer_server_ciphers on;
    location / {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:4444/;
        client_max_body_size 1000M;
    }
}
dsun29 commented 6 years ago

Thank you savikko! I don't have proxy_set_header in the nginx.conf file. I am unable to test it now as I don't have access to my site but I believe it is the reason.

savikko commented 6 years ago

No prob. I think issue can be closed then.

jxsl13 commented 6 years ago

for caddy use the proxy parameter "transparent" to fix this issue.

openkb.example.de {
        proxy / localhost:4444 {
                transparent
        }
}