Skip to content
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

Why I can not get the response "pong" while I run the example1? #34

Open
mumingv opened this issue Jan 22, 2023 · 1 comment
Open

Why I can not get the response "pong" while I run the example1? #34

mumingv opened this issue Jan 22, 2023 · 1 comment

Comments

@mumingv
Copy link

mumingv commented Jan 22, 2023

main.go:

package main

import (
	"log"
	"net/http"

	"github.com/gin-gonic/autotls"
	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()

	// Ping handler
	r.GET("/ping", func(c *gin.Context) {
		c.String(http.StatusOK, "pong")
	})

	log.Fatal(autotls.Run(r, "example1.com", "example2.com"))
}

After running the main.go,I typed https://localhost:443/ping in browser, I just get "ERR_SSL_PROTOCOL_ERROR" wrong message.

And the console shows the error messages as below:

2023/01/22 17:58:05 http: TLS handshake error from [::1]:51238: acme/autocert: server name component count invalid
2023/01/22 17:58:05 http: TLS handshake error from [::1]:51239: acme/autocert: server name component count invalid
2023/01/22 17:58:05 http: TLS handshake error from [::1]:51240: acme/autocert: server name component count invalid
2023/01/22 17:58:06 http: TLS handshake error from [::1]:51241: acme/autocert: server name component count invalid

I don't know what happens. Who can tell me why?

@mumingv mumingv changed the title Why I can not get the write result while I run the example1? Why I can not get the response "pong" while I run the example1? Jan 22, 2023
@mumingv mumingv closed this as completed Jan 22, 2023
@mumingv mumingv reopened this Jan 22, 2023
@EndlessParadox1
Copy link

You should use http://yourdomainname.com/ping. this package is used for redirect http request to https and meanwhile force you to use the domain configured to access. For use locally, you can edit your hosts, resolving domain name you like to localhost. As for server, you should buy several domain name that resolved to your IP and configure it in autotls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants