oesmith / puffing-billy

A rewriting web proxy for testing interactions between your browser and external sites. Works with ruby + rspec.
MIT License
654 stars 170 forks source link

Net::ReadTimeout #311

Closed ngouy closed 2 years ago

ngouy commented 3 years ago

When working with subdomains, with or without me trying to whitelist my queries to my "localhost", I have Net::ReadTimeout only for my request to local subdomains

in my hosts file :

127.0.0.1 localhost my_subdomain.localhost.local_test

in my rails_helper:

config.around(:each, :feature_with_subdomain) do |example|
  when "system", "feature"
  default_host = Capybara.app_host
  Capybara.app_host = "http://my_subdomain.localhost.local_test"

  example.run

  Capybara.app_host = default_host
end

Billy.config.whitelist << /.*/

without the billy_selenium, it works, with the billy, it only works for request towards localhost, but not my custom subdomain. It just hang out for a wile and time out

ronwsmith commented 3 years ago

What does the rest of your Billy config look like?

Billy is a browser proxy, to handle client-side requests, it is not used for loading the app_host itself, which might be different behavior than you're looking for.

ngouy commented 3 years ago

Hey @ronwsmith, thanks for the help

the config is the exact one above, I'm only whitelisting everything, so billy should let everything works as if it was not here

Sadly it doesn't work with my already existing subdomain configuration

ronwsmith commented 3 years ago

I'm not sure what you're attempting to do. Are you looking to avoid using Billy for some of your tests? It's implemented as a stub or a browser driver which it doesn't look like you're using.

ngouy commented 3 years ago

@ronwsmith I am trying to understand why it doesn't work for my current setup with subdomains.

The first step for me was trying to understand how does Billy works. In my debug process, one of the things that felt wrong is the example I give here: Even bypassing everything, I still have an issue where I have an infinite load.

The example I give here isn't the final usage I want for my project, but more of an: "something is wrong because even when I bypass everything, I have an issue that I don't have without Billy installed."

ronwsmith commented 3 years ago

From the config you provided, you're not using Billy at all, so the whitelist configuration change isn't doing anything. If you are using the billy driver or stub anywhere, please include that information.

ngouy commented 3 years ago

No, that's exactly my point

I don't have the gem: My system specs are working perfectly I install the gem, but bypass everything from Billy: It should just do nothing, but sadly, and that's the point of this ticket, it does something: my specs aren't working anymore (infinite load on my specs until it just time out) the question of this ticket is "why?"

As I bypass everything, Billy should be transparent, and my specs should works just as before I install the gem. (by transparent config I mean using the billy selenium driver, instead of the chrome one, and using the provided config where I whitelist everything)

I guess I should have been more precise, but I didn't even use billy in one of my specs, because Billy literally broken every already existing one, even with a configuration where it should just do nothing

ronwsmith commented 3 years ago

Again, your whitelist config line does nothing without the driver or proxy being used, so you are not "bypassing" anything. The Billy proxy is lazy-loaded and won't start until it's used, so nothing is running at all. I suspect something else is going on locally with gem dependency conflicts.

You can try checking the logs to see if you see Billy reporting any strange behaviors (but you likely won't unless you're initializing it somewhere that you haven't included).

ngouy commented 3 years ago

As I said, I'm using the driver.

by transparent config I mean using the billy selenium driver, instead of the chrome one, and using the provided config where I whitelist everything

I will try to create a demo dummy app @ronwsmith 👍, this may be much more easier to understand

ronwsmith commented 3 years ago

Please include how and where you're using the driver and/or proxy stub.

ronwsmith commented 2 years ago

Stale issue, closing. Feel free to reopen if this is still desired.