-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Server only listening to HTTP_PORT with TLS when Let's Encrypt is enabled #5280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same here! Although I noticed something in the code:
My point being, if LetsEncrypt is enabled, then the RedirectOtherPort will not be reached. I was tempted to swap the two conditions... Ref: https://github.com/go-gitea/gitea/blob/master/cmd/web.go#L174-L181 |
@fser that is ok as letsencrypt handler will also act as http redirector to redirect http to https |
How does it work? It's only listening on |
It does not use |
It could be also bug can't tell atm as I have not tried this functionality yet :) |
I do not see anything listening on |
I have the same issue: when I took a couple of minutes to look at the code and I identified the problem: On line 83 of cmd/web.go, the HTTP server is supposed to be started. This goroutine is launched and its error return value is ignored, which means there are no errors in any logs (if there were, people would have certainly already caught the bug). The problem lies in this expression: If in that expression on line 83 |
I have posted a PR here: #5525 (replaced PR, pushed to the wrong org) |
* Fix the Let's Encrypt handler by listening on a valid address Also handle errors in the HTTP server go routine, return a fatal error when something goes wrong. Thanks to @gbl08ma for finding the actual bug Here is an example of the error handling: 2018/12/11 14:23:07 [....io/gitea/cmd/web.go:87 func1()] [E] Failed to start the Let's Encrypt handler on port 30: listen tcp 0.0.0.0:30: bind: permission denied Closes #5280 * Fix a typo
* Fix the Let's Encrypt handler by listening on a valid address Also handle errors in the HTTP server go routine, return a fatal error when something goes wrong. Thanks to @gbl08ma for finding the actual bug Here is an example of the error handling: 2018/12/11 14:23:07 [....io/gitea/cmd/web.go:87 func1()] [E] Failed to start the Let's Encrypt handler on port 30: listen tcp 0.0.0.0:30: bind: permission denied Closes go-gitea#5280 * Fix a typo
* Fix the Let's Encrypt handler by listening on a valid address Also handle errors in the HTTP server go routine, return a fatal error when something goes wrong. Thanks to @gbl08ma for finding the actual bug Here is an example of the error handling: 2018/12/11 14:23:07 [....io/gitea/cmd/web.go:87 func1()] [E] Failed to start the Let's Encrypt handler on port 30: listen tcp 0.0.0.0:30: bind: permission denied Closes #5280 * Fix a typo
I could confirm that the Let's Encrypt setup in Gitea works now, I deployed the latest Docker tag and now have a valid Let's Encrypt certificate |
Description
Let's Encrypt support was merged in #4189 and ships in 1.6.0-rc1. Has anyone been able to make this work? Reading the code (
gitea/cmd/web.go
Line 83 in 3d84f1f
PORT_TO_REDIRECT
from the config file is supposed to be used to redirect HTTP to HTTPS and also by Let's Encrypt to generate certificates. However I'm only getting a daemon running on theHTTP_PORT
(using TLS). WhenENABLE_LETSENCRYPT
is set tofalse
andREDIRECT_OTHER_PORT
is set totrue
a daemon listens onPORT_TO_REDIRECT
and redirects HTTP to HTTPS. I can reproduce the issue running the 1.6.0-rc2 binary directly on macOS, as well as in Kubernetes/Docker.Update: Setting
PORT_TO_REDIRECT
or not leads to the same result, only listening on HTTPSHere are the relevant parts of my config:
Am I missing something? I have checked the code, as well as read https://docs.gitea.io/en-us/https-setup/
The text was updated successfully, but these errors were encountered: