mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2026-01-28 01:21:16 +00:00
22 lines
379 B
Go
22 lines
379 B
Go
package utils
|
|
|
|
import "net/http"
|
|
|
|
func GetInstanceProtocol(r *http.Request) string {
|
|
proto := "https"
|
|
if !Config.Secure {
|
|
proto = "http"
|
|
}
|
|
if Config.ProtocolDetection {
|
|
xproto := r.Header.Get("X-Forwarded-Proto")
|
|
if xproto != "" {
|
|
proto = xproto
|
|
}
|
|
}
|
|
return proto
|
|
}
|
|
|
|
func GetInstanceUrl(r *http.Request) string {
|
|
return GetInstanceProtocol(r) + "://" + r.Host
|
|
}
|