feat: close connection if no tunneling request is specified
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 7m18s
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 7m18s
This commit is contained in:
@ -63,7 +63,7 @@ var allowedCors = make(map[string]bool)
|
||||
var isAllowedAllCors = false
|
||||
|
||||
func init() {
|
||||
corsList := utils.Getenv("cors_list")
|
||||
corsList := utils.Getenv("CORS_LIST")
|
||||
if corsList == "*" {
|
||||
isAllowedAllCors = true
|
||||
} else {
|
||||
@ -86,11 +86,11 @@ func NewHTTPServer() error {
|
||||
}
|
||||
}
|
||||
|
||||
listener, err := net.Listen("tcp", ":80")
|
||||
listener, err := net.Listen("tcp", fmt.Sprintf(":%s", utils.Getenv("HTTP_PORT")))
|
||||
if err != nil {
|
||||
return errors.New("Error listening: " + err.Error())
|
||||
}
|
||||
if utils.Getenv("tls_enabled") == "true" && utils.Getenv("tls_redirect") == "true" {
|
||||
if utils.Getenv("TLS_ENABLED") == "true" && utils.Getenv("TLS_ENABLED") == "true" {
|
||||
redirectTLS = true
|
||||
}
|
||||
go func() {
|
||||
@ -129,7 +129,7 @@ func Handler(conn net.Conn) {
|
||||
|
||||
if redirectTLS {
|
||||
conn.Write([]byte("HTTP/1.1 301 Moved Permanently\r\n" +
|
||||
fmt.Sprintf("Location: https://%s.%s/\r\n", slug, utils.Getenv("domain")) +
|
||||
fmt.Sprintf("Location: https://%s.%s/\r\n", slug, utils.Getenv("DOMAIN")) +
|
||||
"Content-Length: 0\r\n" +
|
||||
"Connection: close\r\n" +
|
||||
"\r\n"))
|
||||
|
||||
Reference in New Issue
Block a user