Welcome to mirror list, hosted at ThFree Co, Russian Federation.

director.go « serverless « serving « internal - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 83d792c3b7983e202a2b94cc8771b33fcd8a2e88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package serverless

import (
	"net/http"
	"strings"
)

// NewDirectorFunc returns a director function capable of configuring a proxy
// request
func NewDirectorFunc(cluster Cluster) func(*http.Request) {
	return func(request *http.Request) {
		request.Host = cluster.Address
		request.URL.Host = strings.Join([]string{cluster.Address, cluster.Port}, ":")
		request.URL.Scheme = "https"
		request.Header.Set("User-Agent", "GitLab Pages Daemon")
		request.Header.Set("X-Forwarded-For", "123") // TODO
	}
}