~mendelmaleh/bin

2fc3ccd24bc31000a44b10d4117042ea154c694c — Mendel E 3 months ago 17f39d6 master
Try getting scheme from X-Forwarded-Proto
1 files changed, 7 insertions(+), 1 deletions(-)

M main.go
M main.go => main.go +7 -1
@@ 9,6 9,7 @@ import (
	"math/rand"
	"net/http"
	"net/url"
	"strings"
	"time"
	"unicode"



@@ 160,11 161,16 @@ func Bin(w http.ResponseWriter, r *http.Request, b *bitcask.Bitcask) {

		// return id
		u := url.URL{
			Scheme: "http",
			Host:   r.Host,
			Path:   "/", // todo: use config or dynamic
		}

		if v, ok := r.Header["X-Forwarded-Proto"]; ok {
			u.Scheme = strings.Join(v, "")
		} else {
			u.Scheme = "http"
		}

		q := url.Values{}
		q.Set("id", id)