File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -144,14 +144,26 @@ func (_this *proxyController) processRequest(
144
144
targetURL * url.URL ,
145
145
traceID string ,
146
146
) {
147
+ // Create appropriate context based on request type
148
+ var reqContext context.Context
149
+ if reqType == mirrorRequest {
150
+ // For mirror requests, use controller context with timeout.
151
+ var cancel context.CancelFunc
152
+ reqContext , cancel = context .WithTimeout (_this .ctx , _this .cfg .Proxy .Timeout )
153
+ defer cancel ()
154
+ } else {
155
+ // For proxy requests, use the gin context
156
+ reqContext = c .Request .Context ()
157
+ }
158
+
147
159
// Instead of cloning, create a new request.
148
160
targetPath := c .Request .URL .Path
149
161
if c .Request .URL .RawQuery != "" {
150
162
targetPath += "?" + c .Request .URL .RawQuery
151
163
}
152
164
153
165
req , err := http .NewRequestWithContext (
154
- c . Request . Context () ,
166
+ reqContext ,
155
167
c .Request .Method ,
156
168
targetURL .String ()+ targetPath ,
157
169
bytes .NewBuffer (bodyBytes ),
You can’t perform that action at this time.
0 commit comments