Skip to content

error.HeaderTooLarge #672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
7flash opened this issue May 20, 2025 · 1 comment
Open

error.HeaderTooLarge #672

7flash opened this issue May 20, 2025 · 1 comment

Comments

@7flash
Copy link

7flash commented May 20, 2025

To reproduce, begin with example from README and replace URL to "https://x.com"

'use strict'

import puppeteer from 'puppeteer-core';

// use browserWSEndpoint to pass the Lightpanda's CDP server address.
const browser = await puppeteer.connect({
  browserWSEndpoint: "ws://127.0.0.1:9222",
});

// The rest of your script remains the same.
const context = await browser.createBrowserContext();
const page = await context.newPage();

// Dump all the links from the page.
await page.goto('https://x.com');

const links = await page.evaluate(() => {
  return Array.from(document.querySelectorAll('a')).map(row => {
    return row.getAttribute('href');
  });
});

console.log(links);

await page.close();
await context.close();
await browser.disconnect();

which results in failure on the client

 95 |         }
 96 |         this.#navigationResponseReceived?.resolve();
 97 |     }
 98 |     #onFrameDetached(frame) {
 99 |         if (this.#frame === frame) {
100 |             this.#terminationDeferred.resolve(new Error('Navigating frame was detached'));
                                                    ^
error: Navigating frame was detached

because of this error in running lightpanda instance

info(server): accepting new conn...
info(server): client connected
warning(http_client): HTTP error: error.HeaderTooLarge (GET https://x.com/ 0)
@karlseguin
Copy link
Collaborator

x.com sends a single header line that's 10043 bytes. We currently limit individual header lines to 4096 bytes. Thinking out loud, we could:

1 - increase the maximum allowed header line
2 - ignore any very large header (with a log message)
3 - ignore this specific header content-security-policy for all websites

Any of these behaviors could be under a CLI flag.... e..g ./lightpanda --max_header_len 100000 --ignore_response_header 'content-security-policy'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants