summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/caddyhttp/marshalers.go6
-rw-r--r--modules/caddyhttp/matchers_test.go5
2 files changed, 8 insertions, 3 deletions
diff --git a/modules/caddyhttp/marshalers.go b/modules/caddyhttp/marshalers.go
index e35a73e..7f95923 100644
--- a/modules/caddyhttp/marshalers.go
+++ b/modules/caddyhttp/marshalers.go
@@ -26,11 +26,11 @@ type LoggableHTTPRequest struct{ *http.Request }
// MarshalLogObject satisfies the zapcore.ObjectMarshaler interface.
func (r LoggableHTTPRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error {
- enc.AddString("method", r.Method)
- enc.AddString("uri", r.RequestURI)
- enc.AddString("proto", r.Proto)
enc.AddString("remote_addr", r.RemoteAddr)
+ enc.AddString("proto", r.Proto)
+ enc.AddString("method", r.Method)
enc.AddString("host", r.Host)
+ enc.AddString("uri", r.RequestURI)
enc.AddObject("headers", LoggableHTTPHeader(r.Header))
if r.TLS != nil {
enc.AddObject("tls", LoggableTLSConnState(*r.TLS))
diff --git a/modules/caddyhttp/matchers_test.go b/modules/caddyhttp/matchers_test.go
index 883680f..9a2836d 100644
--- a/modules/caddyhttp/matchers_test.go
+++ b/modules/caddyhttp/matchers_test.go
@@ -123,6 +123,11 @@ func TestHostMatcher(t *testing.T) {
expect: false,
},
{
+ match: MatchHost{"www.*.*"},
+ input: "www.example.com",
+ expect: true,
+ },
+ {
match: MatchHost{"example.com"},
input: "example.com:5555",
expect: true,