1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-26 14:27:04 +00:00

iris.TLS starts a secondary http redirection server now (like AutoTLS did) and add 'iris.TLSNoRedirect' to disable it (on both TLS and AutoTLS)

Former-commit-id: c7a535bf860a67604de3d09ade30599611e096f1
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-05-08 21:13:12 +03:00
parent 116503a9a5
commit b6a36bf28d
7 changed files with 168 additions and 86 deletions

View File

@@ -24,4 +24,9 @@ func main() {
// use real whitelisted domain(or domains split by whitespaces)
// and a non-public e-mail instead or edit your hosts file.
app.Run(iris.AutoTLS(":443", "example.com", "mail@example.com"))
// Note: to disable automatic "http://" to "https://" redirections pass the `iris.TLSNoRedirect`
// host configurator to TLS or AutoTLS functions, e.g:
//
// app.Run(iris.AutoTLS(":443", "example.com", "mail@example.com", iris.TLSNoRedirect))
}

View File

@@ -1,11 +1,7 @@
package main
import (
"net/url"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/core/host"
)
func main() {
@@ -19,11 +15,13 @@ func main() {
ctx.Writef("Hello from the SECURE server on path /mypath")
})
// to start a new server listening at :80 and redirects
// to the secure address, then:
target, _ := url.Parse("https://127.0.0.1:443")
go host.NewRedirection("127.0.0.1:80", target, iris.StatusMovedPermanently).ListenAndServe()
// start the server (HTTPS) on port 443, this is a blocking func
// Start the server (HTTPS) on port 443,
// and a secondary of (HTTP) on port :80 which redirects requests to their HTTPS version.
// This is a blocking func.
app.Run(iris.TLS("127.0.0.1:443", "mycert.cert", "mykey.key"))
// Note: to disable automatic "http://" to "https://" redirections pass the `iris.TLSNoRedirect`
// host configurator to TLS or AutoTLS functions, e.g:
//
// app.Run(iris.TLS("127.0.0.1:443", "mycert.cert", "mykey.key", iris.TLSNoRedirect))
}

View File

@@ -14,10 +14,6 @@
syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
package helloworld;
// The greeting service definition.