kennygrant / gohackernews

Golang News - curated links about the Go programming language
https://golangnews.com
MIT License
283 stars 42 forks source link

Production port should be 433 if using autocert for SSL certificate #35

Open abishekmuthian opened 5 years ago

abishekmuthian commented 5 years ago

By default production port is set to 80, it needs to be 443 as there's redirection from 80 to 443.

But in order for autocert's LetsEncrypt first verification to work, the redirection has to be handled by certManager's handler in the fragmenta server(https://github.com/fragmenta/server/issues/8).

When that's done, calling StartRedirectAll is unnecessary as the above will do the same.

Perhaps, since gohackernews was using certificates in key to start with; it worked without the need for initial LetsEncrypt callback after autocert implementation thereby not facing this issue.

pjebs commented 4 years ago

How did you get it to work on port 443?

abishekmuthian commented 3 years ago

@pjebs Please refer to this - https://github.com/fragmenta/server/issues/8.

I used go http.ListenAndServe(":http", certManager.HTTPHandler(nil)) with production port 433, But as Kenny suggests use StartTLSAuto.