Skip to content

Commit 566ec6f

Browse files
authored
Merge pull request #107 from doringeman/cors
runner: Do not allow CORS headers set by the inference engines
2 parents 8907b3d + 3d466a2 commit 566ec6f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/inference/scheduling/runner.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ func run(
118118
r.URL.Path = trimRequestPathToOpenAIRoot(r.URL.Path)
119119
r.URL.RawPath = trimRequestPathToOpenAIRoot(r.URL.RawPath)
120120
}
121+
proxy.ModifyResponse = func(resp *http.Response) error {
122+
// CORS headers are set by the CorsMiddleware from pkg/inference/cors.go,
123+
// so we remove them here to avoid duplication and potential misconfiguration.
124+
resp.Header.Del("Access-Control-Allow-Origin")
125+
return nil
126+
}
121127
proxy.Transport = transport
122128
proxyLog := log.Writer()
123129
proxy.ErrorLog = logpkg.New(proxyLog, "", 0)

0 commit comments

Comments
 (0)