|
48 | 48 | import jakarta.servlet.ServletException; |
49 | 49 | import jakarta.servlet.http.HttpServletRequest; |
50 | 50 | import jakarta.servlet.http.HttpServletResponse; |
| 51 | +import org.apache.commons.lang3.StringUtils; |
51 | 52 | import org.slf4j.Logger; |
52 | 53 | import org.slf4j.LoggerFactory; |
53 | 54 | import org.springframework.context.annotation.Lazy; |
@@ -109,7 +110,10 @@ public class ProxyMappingManager { |
109 | 110 | try { |
110 | 111 | proxy = proxyService.getProxy(proxyIdAttachment.proxyId); |
111 | 112 | if (proxy != null && !proxy.getStatus().isUnavailable() && !isShuttingDown) { |
112 | | - String originalURL = responseExchange.getAttachment(ATTACHMENT_ORIGINAL_URL).url; |
| 113 | + String originalURL = responseExchange.getRequestURL(); |
| 114 | + if (!StringUtils.isBlank(responseExchange.getQueryString())) { |
| 115 | + originalURL += "?" + responseExchange.getQueryString(); |
| 116 | + } |
113 | 117 | String proxiedTo = getProxiedToFromResponseExchange(proxy, responseExchange); |
114 | 118 | slogger.info(proxy, String.format("Proxy unreachable/crashed, stopping it now, failed request: %s %s was proxied to: %s, status: %s", |
115 | 119 | responseExchange.getRequestMethod(), originalURL, proxiedTo, responseExchange.getStatusCode())); |
@@ -273,7 +277,10 @@ private String getProxiedToFromResponseExchange(Proxy proxy, HttpServerExchange |
273 | 277 | String relativePath = responseExchange.getRelativePath(); |
274 | 278 | URI target = getTargetFromResponseExchange(proxy, relativePath); |
275 | 279 |
|
276 | | - return target + relativePath + responseExchange.getQueryString(); |
| 280 | + if (!StringUtils.isBlank(responseExchange.getQueryString())) { |
| 281 | + return target + relativePath + "?" + responseExchange.getQueryString(); |
| 282 | + } |
| 283 | + return target + relativePath; |
277 | 284 | } |
278 | 285 |
|
279 | 286 | private URI getTargetFromResponseExchange(Proxy proxy, String relativePath) { |
|
0 commit comments