gogs/gogs

Getting TLS handshake error while trying to use https in localhost

koolkunz opened this issue · 0 comments

Gogs version

0.13.0

Git version

  • Server: 2.42.0.2
  • Client: 2.42.0.2

Operating system

Windows 10

Database

MySQL 8.0

Describe the bug

I am trying to setup gogs within my organisations intranet.

I have generated the cert.pem and key.pem using the gogs cert command and made the appropriate changes in custom config.

But when I run the gogs server and try to open https://localhost:4040/ on the web browser it gives invalid certificate error and the following error is shown in the gogs server log:
2023/10/18 13:51:40 http: TLS handshake error from [::1]:53902: remote error: tls: unknown certificate
2023/10/18 13:51:40 http: TLS handshake error from [::1]:53903: remote error: tls: unknown certificate

Please help

To reproduce

run the command:
.\gogs.exe cert -ca=true -duration=8760h0m0s -host=localhost

change custom config:
[server]
PROTOCOL = https
DOMAIN = localhost
HTTP_PORT = 4040
EXTERNAL_URL = https://localhost:4040/
CERT_FILE = cert.pem
KEY_FILE = key.pem
DISABLE_SSH = true
SSH_PORT = 22
START_SSH_SERVER = false
OFFLINE_MODE = true

and then run the server using:
.\gogs.exe web

Expected behavior

I should not get certificate invalid error in the browser.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct