diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2019-05-20 17:15:38 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2019-05-20 17:15:38 -0600 |
commit | aaacab1bc3790e3a207ae5d70ca6559cac265bff (patch) | |
tree | 0a39a5fa0fce499c1b278738ef4189e3f4088974 /modules/caddyhttp/caddyhttp.go | |
parent | d22f64e6d41117c242fc4ecd00179e68b8f118c5 (diff) |
Sanitize paths in static file server; some cleanup
Also remove AutomaticHTTPSError for now
Diffstat (limited to 'modules/caddyhttp/caddyhttp.go')
-rw-r--r-- | modules/caddyhttp/caddyhttp.go | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go index 41b0c66..e5b9f61 100644 --- a/modules/caddyhttp/caddyhttp.go +++ b/modules/caddyhttp/caddyhttp.go @@ -95,21 +95,11 @@ func (app *App) Validate() error { return nil } -// AutomaticHTTPSError represents an error received when attempting to enable automatic https. -type AutomaticHTTPSError struct { - internal error -} - -// Error returns the error string for automaticHTTPSError. -func (a AutomaticHTTPSError) Error() string { - return fmt.Sprintf("enabling automatic HTTPS: %v", a.internal.Error()) -} - // Start runs the app. It sets up automatic HTTPS if enabled. func (app *App) Start() error { err := app.automaticHTTPS() if err != nil { - return &AutomaticHTTPSError{internal: err} + return fmt.Errorf("enabling automatic HTTPS: %v", err) } for srvName, srv := range app.Servers { @@ -243,7 +233,7 @@ func (app *App) automaticHTTPS() error { if parts := strings.SplitN(port, "-", 2); len(parts) == 2 { port = parts[0] } - redirTo := "https://{request.host}" + redirTo := "https://{http.request.host}" httpsPort := app.HTTPSPort if httpsPort == 0 { @@ -252,7 +242,7 @@ func (app *App) automaticHTTPS() error { if port != strconv.Itoa(httpsPort) { redirTo += ":" + port } - redirTo += "{request.uri}" + redirTo += "{http.request.uri}" redirRoutes = append(redirRoutes, ServerRoute{ matchers: []RequestMatcher{ |