Skip to content

Commit bd08634

Browse files
committed
Support addPrefix for proxy. v1.0.18
1 parent 4c87a95 commit bd08634

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

httpx-static/main.go

+5
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ func NewComplexProxy(ctx context.Context, proxyUrl, preHook *url.URL, originalRe
176176
if trimPrefix := proxyUrlQuery.Get("trimPrefix"); trimPrefix != "" {
177177
r.URL.Path = strings.TrimPrefix(r.URL.Path, trimPrefix)
178178
}
179+
// Aadd the prefix to path.
180+
if addPrefix := proxyUrlQuery.Get("addPrefix"); addPrefix != "" {
181+
r.URL.Path = addPrefix + r.URL.Path
182+
}
179183

180184
// The original request.Host requested by the client.
181185
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host
@@ -273,6 +277,7 @@ func run(ctx context.Context) error {
273277
fmt.Println(fmt.Sprintf(" Proxy path to backend. For example: http://127.0.0.1:8888/api/webrtc?modifyRequestHost=false"))
274278
fmt.Println(fmt.Sprintf(" Proxy path to backend. For example: http://127.0.0.1:8888/api/webrtc?keepUpsreamServer=true"))
275279
fmt.Println(fmt.Sprintf(" Proxy path to backend. For example: http://127.0.0.1:8888/api/webrtc?trimPrefix=/ffmpeg"))
280+
fmt.Println(fmt.Sprintf(" Proxy path to backend. For example: http://127.0.0.1:8888/api/webrtc?addPrefix=/release"))
276281
fmt.Println(fmt.Sprintf(" -pre-hook string"))
277282
fmt.Println(fmt.Sprintf(" Pre-hook to backend, with request. For example: http://127.0.0.1:8888/api/stat"))
278283
fmt.Println(fmt.Sprintf("Options for HTTPS(letsencrypt cert):"))

httpx-static/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func VersionMinor() int {
3535
}
3636

3737
func VersionRevision() int {
38-
return 17
38+
return 18
3939
}
4040

4141
func Version() string {

0 commit comments

Comments
 (0)