We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 196eab9 commit 2942aa8Copy full SHA for 2942aa8
1 file changed
proxy/upstream.mjs
@@ -185,7 +185,9 @@ function getAgent(isHTTPS, hostname) {
185
186
export function forwardRequest(clientReq, body, signal) {
187
return new Promise((resolve, reject) => {
188
- const upstreamUrl = new URL(clientReq.url, config.upstream);
+ const base = config.upstream.endsWith('/') ? config.upstream.slice(0, -1) : config.upstream;
189
+ const relative = clientReq.url.startsWith('/') ? clientReq.url : '/' + clientReq.url;
190
+ const upstreamUrl = new URL(base + relative);
191
192
const headers = buildUpstreamHeaders(clientReq.headers, upstreamUrl.hostname);
193
if (body) {
0 commit comments