Browse Source
* metrics: Fixing panic while observing with bad exemplars Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Minor cleanup The server is already added to the context. So, we can simply use that to get the server name, which is a field on the server. * Add integration test for auto HTTP->HTTPS redirects A test like this would have caught the problem in the first place Co-authored-by: Matthew Holt <mholt@users.noreply.github.com>master
Dave Henderson
4 years ago
committed by
GitHub
6 changed files with 62 additions and 41 deletions
@ -0,0 +1,22 @@ |
|||
package integration |
|||
|
|||
import ( |
|||
"net/http" |
|||
"testing" |
|||
|
|||
"github.com/caddyserver/caddy/v2/caddytest" |
|||
) |
|||
|
|||
func TestAutoHTTPtoHTTPSRedirects(t *testing.T) { |
|||
tester := caddytest.NewTester(t) |
|||
tester.InitServer(` |
|||
{ |
|||
http_port 9080 |
|||
https_port 9443 |
|||
} |
|||
localhost:9443 |
|||
respond "Yahaha! You found me!" |
|||
`, "caddyfile") |
|||
|
|||
tester.AssertRedirect("http://localhost:9080/", "https://localhost/", http.StatusPermanentRedirect) |
|||
} |
Loading…
Reference in new issue