scrapinghub / splash

Lightweight, scriptable browser as a service with an HTTP API
BSD 3-Clause "New" or "Revised" License
4.04k stars 508 forks source link

Lua set proxy is not working at all #1140

Open syaiful6 opened 2 years ago

syaiful6 commented 2 years ago

I trying to use proxy with splash, so according to documentation I can do this with "on_request" callback and request.set_proxy, but when I go to https://httpbin.org/ip I still see my IP, not the proxy IP.

The lua source is:

function main(splash, args)
  splash:on_request(function(request)
    request.set_proxy{"proxy.crawlera.com", 8011, username = "xxxxxxxxxx", password = "", type = "HTTP"}
  end)
  assert(splash:go(args.url))
  assert(splash:wait(5.0))
  return {
    png = splash:png(),
    har = splash:har(),
  }
end

I got this error in the splash container: Screenshot from 2021-10-02 19-32-42

I am not sure why it complaints set_proxy require 2 positional arguments, since I already give it all required arguments. Am I missing something?

Splash version: 3.5