recycleactor commited on
Commit
e8481cc
·
verified ·
1 Parent(s): 2f75806

Upload server.js

Browse files
Files changed (1) hide show
  1. server.js +9 -1
server.js CHANGED
@@ -517,6 +517,13 @@ server.on('upgrade', (req, clientSocket, head) => {
517
 
518
  const targetUrl = new URL(targetUrlStr);
519
 
 
 
 
 
 
 
 
520
  // Filter headers carefully
521
  const proxyHeaders = {};
522
  for (const h in req.headers) {
@@ -533,7 +540,8 @@ server.on('upgrade', (req, clientSocket, head) => {
533
  host: targetUrl.hostname,
534
  servername: targetUrl.hostname, // CRITICAL FOR SNI (Cloudflare drops without this)
535
  headers: proxyHeaders,
536
- path: targetUrl.pathname + targetUrl.search
 
537
  };
538
 
539
  const proto = targetUrl.protocol === 'wss:' ? require('https') : require('http');
 
517
 
518
  const targetUrl = new URL(targetUrlStr);
519
 
520
+ // Pass along any extra query parameters Lampa might have appended (like &nws_id=...)
521
+ urlObj.searchParams.forEach((value, key) => {
522
+ if (key !== 'url') {
523
+ targetUrl.searchParams.append(key, value);
524
+ }
525
+ });
526
+
527
  // Filter headers carefully
528
  const proxyHeaders = {};
529
  for (const h in req.headers) {
 
540
  host: targetUrl.hostname,
541
  servername: targetUrl.hostname, // CRITICAL FOR SNI (Cloudflare drops without this)
542
  headers: proxyHeaders,
543
+ path: targetUrl.pathname + targetUrl.search,
544
+ rejectUnauthorized: false
545
  };
546
 
547
  const proto = targetUrl.protocol === 'wss:' ? require('https') : require('http');