fix: force fresh agent and cleanup host for outbound proxy
Browse files- outbound-fix.js +4 -3
outbound-fix.js
CHANGED
|
@@ -67,15 +67,16 @@ if (PROXY_URL) {
|
|
| 67 |
newOptions._proxied = true;
|
| 68 |
newOptions.protocol = "https:";
|
| 69 |
newOptions.hostname = proxy.hostname;
|
| 70 |
-
newOptions.host = proxy.host;
|
| 71 |
newOptions.port = proxy.port || 443;
|
| 72 |
|
| 73 |
-
// CRITICAL:
|
| 74 |
newOptions.servername = proxy.hostname;
|
|
|
|
|
|
|
| 75 |
|
| 76 |
// Merge and update headers
|
| 77 |
newOptions.headers = {
|
| 78 |
-
...(headers || {}),
|
| 79 |
"host": proxy.host,
|
| 80 |
"x-target-host": hostname
|
| 81 |
};
|
|
|
|
| 67 |
newOptions._proxied = true;
|
| 68 |
newOptions.protocol = "https:";
|
| 69 |
newOptions.hostname = proxy.hostname;
|
|
|
|
| 70 |
newOptions.port = proxy.port || 443;
|
| 71 |
|
| 72 |
+
// CRITICAL: Force fresh TLS handshake for the new domain
|
| 73 |
newOptions.servername = proxy.hostname;
|
| 74 |
+
delete newOptions.host; // Prefer hostname
|
| 75 |
+
delete newOptions.agent; // Force a new agent to prevent connection reuse issues
|
| 76 |
|
| 77 |
// Merge and update headers
|
| 78 |
newOptions.headers = {
|
| 79 |
+
...(newOptions.headers || {}),
|
| 80 |
"host": proxy.host,
|
| 81 |
"x-target-host": hostname
|
| 82 |
};
|