mirror of
https://github.com/v1k45/pastepass.git
synced 2026-01-06 13:36:54 +00:00
Detect scheme correct when behind a reverse proxy
This commit is contained in:
@@ -47,11 +47,12 @@ func (h *Handler) Paste(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
var scheme string
|
||||
if r.TLS == nil {
|
||||
scheme = "http"
|
||||
if r.Header.Get("X-Forwarded-Proto") != "" {
|
||||
scheme = r.Header.Get("X-Forwarded-Proto")
|
||||
} else {
|
||||
scheme = "https"
|
||||
scheme = "http"
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("%s://%s/p/%s/%s", scheme, r.Host, paste.ID, paste.Key)
|
||||
|
||||
component := views.PasteSuccess(url)
|
||||
|
||||
Reference in New Issue
Block a user