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
"set_proxy" doesn't seem to have an effect for external resources #2
Comments
hmmm... I'll look at this in a bit but how exactly are you configuring the proxy - like this https://github.com/oesmith/puffing-billy/pull/258/files ? Are you sure it's not something you've configured in puffing-billy (IIRC poltergeist/phantomjs had an issue around proxying localhost so maybe you implemented some workaround for that which is interfering)? |
@thbar Ok - I set up a proxy locally and used the following driver registration to configure for it (also tried with
It made the initial request, the https redirect, and all the resource requests through the proxy. I'm going to need more details on your exact configuration to figure out what is happening for you. |
With a bit of work, I've been able to rebuild a self-contained reproduction here (much smaller than my whole Rails app!): https://github.com/thbar/repro-bug-proxy (with CI build!) This is a bit different than my app, because in the reproduction, I'm only asserting that a I implemented 3 tests: one for It's interesting that both All in all - this is how far I went for now. If I find more information (I'll dig a bit), I'll update the issue! |
I wonder if this is an issue in Chrome itself (at least there is a suspicion of this in oesmith/puffing-billy#259). |
So it's definitely because of the |
@thbar This is definitely a puffing-billy issue - The certificate chain it builds isn't compatible with Chrome for some reason. Not sure exactly why, I would guess it's using an out of date encryption but haven't actually dug far enough to confirm. If you just stop it from building its own cert chain (and pass the |
It could also be that Chrome just doesn't like the self signed cert PB returns, and that when a proxy is in use the CDP command doesn't have a chance to ignore it. |
@thbar Ok, this is purely a self-signed cert issue. You can either figure out how to set up the certs as mentioned in the puffing-billy readme - https://github.com/oesmith/puffing-billy#ssl-usage - or an easier solution is just to set the Capybara.register_driver :apparition_with_puffing_billy do |app|
options = {
window_size: [1280, 1024],
headless: true,
js_errors: true,
ignore_https_errors: true,
browser: {
'ignore-certificate-errors' => nil
}
}
Capybara::Apparition::Driver.new(app, options).tap do |driver|
driver.set_proxy(Billy.proxy.host, Billy.proxy.port)
end
end |
@twalpole many thanks - indeed this fixes it on the reproduction! I will verify the behaviour on the actual app & report back. |
For some reason, the problem still occurs with the real app. I will investigate further & re-open if I have more information. |
@twalpole after upgrading to puffing-billy master & reviewing everything from scratch, I can confirm that your fix is working on the real app. Again many thanks - and thanks for your work on apparition! |
I can confirm this fixes an issue for us locally
|
An existing app of mine uses puffing-billy to stub out XHR/JSONP external calls (e.g. Stripe/Recurly) for payments.
When using
poltergeist
(my "legacy" driver), I'm able to define stubs in puffing-billy, and the calls made by the browser to these external resources will then be returned as defined by the stubs.This allows completely isolated yet "full integration" testing of payments scenarios.
When trying out
apparition
(but this same issue happens with cuprite), setting the proxy to puffing-billy works fine, I believe, for all localhost calls.But the external resources, which I normally stub out, are not stubbed out, resulting in real calls.
It's like if the proxy has a bypass for those external resources, for some reason.
I don't have a small reproduction yet, but I can try making one (unless someone is faster than me!).
The text was updated successfully, but these errors were encountered: