question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proxy connection is being refused

See original GitHub issue

The error below suggest that my proxy connection is being refused. The proxy was tested with curl and it is infact working, it requires no credentials which is why the username and password fields were omitted in set_proxy. What else could be the reason for this connection being refused?

–ERROR RenderErrorInfo(type=‘Network’, code=99, text=‘Proxy connection refused’, “message”: “Lua error: [string "…"]:10: network99”, “type”: “LUA_ERROR”, “error”: “network99”},

–TESTING PROXY curl --proxy 127.0.0.1:24000 "http://lumtest.com/myip.json"

–SPIDER CODE

import scrapy
from scrapy_splash import SplashRequest

script = """
function main(splash)
  splash:on_request(function(request)
    request:set_proxy{
        host = "127.0.0.1",
        port = 24000,
    }
  end)

  assert(splash:go{
    splash.args.url,
    headers=splash.args.headers,
    http_method=splash.args.http_method,
    body=splash.args.body,
    })
  assert(splash:wait(0.5))

  local entries = splash:history()
  local last_response = entries[#entries].response
  return {
    url = splash:url(),
    headers = last_response.headers,
    http_status = last_response.status,
    html = splash:html(),
  }
end
"""
class TestlumSpider(scrapy.Spider):
    name = "testlum"
    allowed_domains = ["amazon.ca"]

    def start_requests(self):
		url = "https://www.amazon.ca/dp/1482703270"
 	        yield SplashRequest(url, self.parse, endpoint='execute',
                            args={'lua_source': script,})

    def parse(self, response):
        pass

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
SergeyKalutskycommented, May 3, 2018

Hi, everyone. I’ve managed to struggle with the same issue for the last couple of hours. The problem is accessing a localhost from a docker container. According to docker docs: “The host has a changing IP address (or none if you have no network access). From 18.03 onwards our recommendation is to connect to the special DNS name host.docker.internal, which resolves to the internal IP address used by the host. The gateway is also reachable as gateway.docker.internal.” https://docs.docker.com/docker-for-windows/networking/#per-container-ip-addressing-is-not-possible So the solution in this case is to change the host name: from function main(splash) splash:on_request(function(request) request:set_proxy{ host = "127.0.0.1", port = 24000, } end) to function main(splash) splash:on_request(function(request) request:set_proxy{ host = "host.docker.internal", port = 24000, } end)

0reactions
chipzzzcommented, Dec 15, 2020

@kmike If i’m using scraper api as a proxy do I need tor as a service running? What does tor do if you’re running an external proxy?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The proxy server is refusing connections error in Firefox or ...
This problem occurs mainly when you have a wrong or dead proxy configuration, or you are using some VPN service. However, this problem...
Read more >
How to Resolve 'Proxy server is refusing connections' Error on ...
Method 1: Forcing Firefox to Auto Detect Proxy Settings · Method 2: Adding URL SSL port to the allowed list (if applicable) ·...
Read more >
Why is my proxy server is refusing connections? How do I fix ...
In the Internet Properties window, switch to the Connections tab and then click Lan settings · In the Local Area Network (LAN) settings...
Read more >
How to Fix the Firefox Proxy Server When It's Refusing ...
The Firefox proxy server connection error is common if you're using Firefox on a LAN, such as on a corporate network. The first...
Read more >
I get this message," The proxy server is refusing connections"
Check the proxy settings to make sure that they are correct. Contact your network administrator to make sure the proxy server is working....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found