Google app engine 在Google应用程序引擎中处理HTTPS请求
在GAE中,我只使用默认域名:https://*.appspot.com,因此我不需要生成自签名证书 Google App Engine文档指定应如何配置App.yaml以服务SSL连接: 但为了在Go中提供HTTPS连接,我编写了以下代码示例,其中需要指定证书的文件名:Google app engine 在Google应用程序引擎中处理HTTPS请求,google-app-engine,ssl,go,https,ssl-certificate,Google App Engine,Ssl,Go,Https,Ssl Certificate,在GAE中,我只使用默认域名:https://*.appspot.com,因此我不需要生成自签名证书 Google App Engine文档指定应如何配置App.yaml以服务SSL连接: 但为了在Go中提供HTTPS连接,我编写了以下代码示例,其中需要指定证书的文件名: import ( "net/http" ) func main() { go http.ListenAndServeTLS(Address, "cert.pem", "key.pem", nil) } 如
import (
"net/http"
)
func main() {
go http.ListenAndServeTLS(Address, "cert.pem", "key.pem", nil)
}
如果我自己不生成证书,我不知道在这种情况下如何为SSL请求提供服务。您不需要在App Engine上调用http.listendServetls。如果您的
app.yaml
设置正确,流量将通过SSL为您提供服务。最小的应用程序引擎应用程序可能如下所示:
package main
import (
"fmt"
"net/http"
)
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hi")
}
你不需要在appengine上调用http.ListenAndServeTLS。如果您的
app.yaml
设置正确,流量将通过SSL为您提供服务。最小的应用程序引擎应用程序可能如下所示:
package main
import (
"fmt"
"net/http"
)
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hi")
}
非常感谢。我会尽快检查的谢谢!我很快会查的