Coder Social home page Coder Social logo

Comments (6)

deepch avatar deepch commented on April 25, 2024 3

thx I run it

	m := &autocert.Manager{
		Prompt:     autocert.AcceptTOS,
		HostPolicy: autocert.HostWhitelist(panel.Config.Web.DomainNames[0:]...),
	}
	dir := cacheDir()
	fmt.Println("Using cache: ", dir)
	if err := os.MkdirAll(dir, 0700); err != nil {
		log.Printf("warning: autocert.NewListener not using a cache: %v", err)
	} else {
		m.Cache = autocert.DirCache(dir)
	}
	go http.ListenAndServe(":http", m.HTTPHandler(panel.GinInstance))
	return autotls.RunWithManager(panel.GinInstance, *m)

if use go http.ListenAndServe(":http", m.HTTPHandler(nil)) <--- nil work as redirect
if use go http.ListenAndServe(":http", m.HTTPHandler(panel.GinInstance)) <--- panel.GinInstance work as http and cert receive no problem

thx you.

from autotls.

deepch avatar deepch commented on April 25, 2024

Also does not work.

from autotls.

SilverCory avatar SilverCory commented on April 25, 2024

@deepch it won't because tls-sni is disabled on letsencrypt's end, you have to use http-01

You can do this in a manner similar to below

	m := &autocert.Manager{
		Prompt:     autocert.AcceptTOS,
		HostPolicy: autocert.HostWhitelist(panel.Config.Web.DomainNames[0:]...),
	}
	dir := cacheDir()
	fmt.Println("Using cache: ", dir)
	if err := os.MkdirAll(dir, 0700); err != nil {
		log.Printf("warning: autocert.NewListener not using a cache: %v", err)
	} else {
		m.Cache = autocert.DirCache(dir)
	}
	go http.ListenAndServe(":http", m.HTTPHandler(nil))
	return autotls.RunWithManager(panel.GinInstance, *m)

from autotls.

deepch avatar deepch commented on April 25, 2024

this method redirect http to https I need pure :80 and https ;(

from autotls.

SilverCory avatar SilverCory commented on April 25, 2024

@deepch you can turn of the redirect by supplying a handler in m.HTTPHandler(...)

from autotls.

appleboy avatar appleboy commented on April 25, 2024

See #26

from autotls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.