feat(clickTtHttpPageRoutes): add meta-refresh URL rewriting for proxy handling
- Implemented a new function to rewrite meta-refresh URLs in HTML, ensuring redirects after login are routed through the proxy while maintaining session integrity. - Updated the proxy GET and POST endpoints to include the new meta-refresh handling, enhancing the overall functionality of the proxy interactions. - Improved error handling in the new function to ensure robustness in processing HTML content.
This commit is contained in:
@@ -106,15 +106,24 @@ async function fetchWithLogging(options) {
|
||||
const baseDomain = extractBaseDomain(url);
|
||||
const startTime = Date.now();
|
||||
|
||||
let origin;
|
||||
try { origin = new URL(url).origin + '/'; } catch { origin = 'https://httv.click-tt.de/'; }
|
||||
const headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
||||
'Accept-Language': 'de,en-US;q=0.7,en;q=0.3',
|
||||
'Referer': origin,
|
||||
'Origin': origin.replace(/\/$/, ''),
|
||||
...customHeaders,
|
||||
};
|
||||
|
||||
try {
|
||||
const fetchOpts = { method, headers, timeout: 30000 };
|
||||
const fetchOpts = {
|
||||
method,
|
||||
headers,
|
||||
timeout: 30000,
|
||||
redirect: method === 'POST' ? 'manual' : 'follow',
|
||||
};
|
||||
if (body && (method === 'POST' || method === 'PUT')) {
|
||||
fetchOpts.body = body;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user