Commit 24fbcde5 authored by Stan Hu's avatar Stan Hu

Workhorse: Allow HTTPS for backends

As part of a requirement to use end-to-end encryption, Workhorse needs
to be able to speak HTTPS for the auth backend.

This has been tested with SSL enabled on Puma.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/353011

Changelog: added
parent 4a9f2ab7
...@@ -18,8 +18,8 @@ func parseAuthBackend(authBackend string) (*url.URL, error) { ...@@ -18,8 +18,8 @@ func parseAuthBackend(authBackend string) (*url.URL, error) {
} }
} }
if backendURL.Scheme != "http" { if backendURL.Scheme != "http" && backendURL.Scheme != "https" {
return nil, fmt.Errorf("invalid scheme, only 'http' is allowed: %q", authBackend) return nil, fmt.Errorf("invalid scheme, only 'http' and 'https' are allowed: %q", authBackend)
} }
if backendURL.Host == "" { if backendURL.Host == "" {
......
...@@ -10,7 +10,7 @@ func TestParseAuthBackendFailure(t *testing.T) { ...@@ -10,7 +10,7 @@ func TestParseAuthBackendFailure(t *testing.T) {
failures := []string{ failures := []string{
"", "",
"ftp://localhost", "ftp://localhost",
"https://example.com", "gopher://example.com",
} }
for _, example := range failures { for _, example := range failures {
...@@ -27,6 +27,7 @@ func TestParseAuthBackend(t *testing.T) { ...@@ -27,6 +27,7 @@ func TestParseAuthBackend(t *testing.T) {
{"localhost:3000", "localhost:3000", "http"}, {"localhost:3000", "localhost:3000", "http"},
{"http://localhost", "localhost", "http"}, {"http://localhost", "localhost", "http"},
{"localhost", "localhost", "http"}, {"localhost", "localhost", "http"},
{"https://localhost", "localhost", "https"},
} }
for _, example := range successes { for _, example := range successes {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment