Skip to content

Commit 4ea89de

Browse files
authored
Merge pull request #33 from DaniilSokolyuk/disable-path-normalizing
Disable Path Normalizing option.
2 parents 27fef95 + e7ba6fa commit 4ea89de

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

reverseproxy.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ func (p *ReverseProxy) init() {
6868

6969
for idx, addr := range p.opt.addresses {
7070
p.clients[idx] = &fasthttp.HostClient{
71-
Addr: addr,
72-
Name: _fasthttpHostClientName,
73-
IsTLS: p.opt.tlsConfig != nil,
74-
TLSConfig: p.opt.tlsConfig,
71+
Addr: addr,
72+
Name: _fasthttpHostClientName,
73+
IsTLS: p.opt.tlsConfig != nil,
74+
TLSConfig: p.opt.tlsConfig,
75+
DisablePathNormalizing: p.opt.disablePathNormalizing,
7576
}
7677
}
7778

@@ -82,10 +83,11 @@ func (p *ReverseProxy) init() {
8283
p.bla = nil
8384
p.clients = append(p.clients,
8485
&fasthttp.HostClient{
85-
Addr: p.oldAddr,
86-
Name: _fasthttpHostClientName,
87-
IsTLS: p.opt.tlsConfig != nil,
88-
TLSConfig: p.opt.tlsConfig,
86+
Addr: p.oldAddr,
87+
Name: _fasthttpHostClientName,
88+
IsTLS: p.opt.tlsConfig != nil,
89+
TLSConfig: p.opt.tlsConfig,
90+
DisablePathNormalizing: p.opt.disablePathNormalizing,
8991
})
9092
}
9193

reverseproxy_option.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ type buildOption struct {
2828

2929
// timeout specify the timeout context with each request.
3030
timeout time.Duration
31+
32+
// disablePathNormalizing disable path normalizing.
33+
disablePathNormalizing bool
3134
}
3235

3336
type funcBuildOption struct {
@@ -78,3 +81,10 @@ func WithTimeout(d time.Duration) Option {
7881
o.timeout = d
7982
})
8083
}
84+
85+
// WithDisablePathNormalizing sets whether disable path normalizing.
86+
func WithDisablePathNormalizing(isDisablePathNormalizing bool) Option {
87+
return newFuncBuildOption(func(o *buildOption) {
88+
o.disablePathNormalizing = isDisablePathNormalizing
89+
})
90+
}

0 commit comments

Comments
 (0)