mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2026-01-27 17:11:13 +00:00
update getUrl.go to use net/http
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
package utils
|
||||
|
||||
import "github.com/gofiber/fiber/v2"
|
||||
import "net/http"
|
||||
|
||||
func GetInstanceProtocol(c *fiber.Ctx) string {
|
||||
func GetInstanceProtocol(r *http.Request) string {
|
||||
proto := "https"
|
||||
if !Config.Secure {
|
||||
proto = "http"
|
||||
}
|
||||
if Config.ProtocolDetection {
|
||||
proto = c.Get("X-Forwarded-Proto", proto)
|
||||
xproto := r.Header.Get("X-Forwarded-Proto")
|
||||
if xproto != "" {
|
||||
proto = xproto
|
||||
}
|
||||
}
|
||||
return proto
|
||||
}
|
||||
|
||||
func GetInstanceUrl(c *fiber.Ctx) string {
|
||||
return GetInstanceProtocol(c) + "://" + c.Hostname()
|
||||
func GetInstanceUrl(r *http.Request) string {
|
||||
return GetInstanceProtocol(r) + "://" + r.Host
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user