Skip to content
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

Browsermob-proxy does not add custom request header #892

Open
Illakkiya opened this issue Feb 9, 2022 · 1 comment
Open

Browsermob-proxy does not add custom request header #892

Illakkiya opened this issue Feb 9, 2022 · 1 comment

Comments

@Illakkiya
Copy link

Using browsermob proxy 2.1.5 with Selenium (3.14.0) Java code I'm trying to add a custom header to Chrome browser but the request header is not getting added to all requests

Sample code:

       BrowserMobProxy proxy = new BrowserMobProxyServer();
        proxy.addHeader("testGroup1" , "*****");
        proxy.start(0);
        Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
        String proxyOption = "--proxy-server=" + seleniumProxy.getHttpProxy();
        chromeOptions.addArguments(proxyOption);

Also tried like the following,

        proxy.addRequestFilter((request, contents, messageInfo) -> {
            request.headers().add("testGroup1" , "*****");
            return null;
        });
        String proxyOption = "--proxy-server=" + seleniumProxy.getHttpProxy();
        chromeOptions.addArguments(proxyOption);
@Wimpje
Copy link

Wimpje commented Jun 30, 2022

same here, the request are captured, but not altered, so I can log the request.getUri() but the headers().add() doesn't do anything to the actual request... ¯_(ツ)_/¯

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