mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2026-02-14 20:45:51 +00:00
update getUrl.go to use net/http
This commit is contained in:
@@ -1,18 +1,21 @@
|
|||||||
package utils
|
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"
|
proto := "https"
|
||||||
if !Config.Secure {
|
if !Config.Secure {
|
||||||
proto = "http"
|
proto = "http"
|
||||||
}
|
}
|
||||||
if Config.ProtocolDetection {
|
if Config.ProtocolDetection {
|
||||||
proto = c.Get("X-Forwarded-Proto", proto)
|
xproto := r.Header.Get("X-Forwarded-Proto")
|
||||||
|
if xproto != "" {
|
||||||
|
proto = xproto
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return proto
|
return proto
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetInstanceUrl(c *fiber.Ctx) string {
|
func GetInstanceUrl(r *http.Request) string {
|
||||||
return GetInstanceProtocol(c) + "://" + c.Hostname()
|
return GetInstanceProtocol(r) + "://" + r.Host
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user