logo
down
shadow

F5 iRule to manage HTTP proxy CONNECT requests


F5 iRule to manage HTTP proxy CONNECT requests

By : user2949705
Date : November 17 2020, 04:28 AM
I wish this helpful for you I finally found a solution.
The VS default behavour is to process the SSL decryption right from the first TCP packet : so one must look at the first TCP packet, and, if it starts with CONNECT,
code :
when CLIENT_ACCEPTED {     # TCP CONTEXT
    TCP::collect 7         # look at the first 7 bytes of TCP stream
}
when CLIENT_DATA {
    if { [TCP::payload] starts_with "CONNECT" } {
        SSL::disable       # disable SSL decryption
    }
}

when HTTP_REQUEST {        # HTTP CONTEXT
    if { [HTTP::method] eq "CONNECT" } {
        HTTP::respond 200  # send HTTP 200
        SSL::enable        # re-enable SSL decryption for next "client hello"
    }
}


Share : facebook icon twitter icon
Should I connect directly to CouchDB's socket and pass HTTP requests or use node.js as a proxy?

Should I connect directly to CouchDB's socket and pass HTTP requests or use node.js as a proxy?


By : beaver
Date : March 29 2020, 07:55 AM
wish help you to fix your issue It's me again. :-)
CouchDB inherits super concurrency handling from Erlang, the language it was written in. Erlang uses lightweight processes and message passing between those processes to achieve excellent performance under high concurrent load. It will take advantage of all cpu cores, too.
Angular2/Angular seed http-proxy-middleware proxy api requests

Angular2/Angular seed http-proxy-middleware proxy api requests


By : Indresh
Date : March 29 2020, 07:55 AM
I hope this helps you . Spent a bit of time trying to get this work and this is what I ended up adding to project.config.ts within the constructor.
code :
   /* Add proxy middleware */
    this.PROXY_MIDDLEWARE = [
      require('http-proxy-middleware')(
        '/basepath/api', {
        ws: false,
        onProxyReq: this.onProxyReq,
        target: 'http://localhost:7000',
        pathRewrite: {
          '^/basepath/api' : '/api'
        }
      })
    ];
onProxyReq(proxyReq: any , req: any, res: any) {
  // add custom headers to request
  proxyReq.setHeader('header_name', 'value');
}
Requests Library Force Use of HTTP/1.1 On HTTPS Proxy CONNECT

Requests Library Force Use of HTTP/1.1 On HTTPS Proxy CONNECT


By : sahmad
Date : March 29 2020, 07:55 AM
To fix the issue you can do httplib (which requests relies upon for HTTP(S) heavy lifting) always uses HTTP/1.0 with CONNECT:
Lib/httplib.py:788:
code :
def _tunnel(self):
    self.send("CONNECT %s:%d HTTP/1.0\r\n" % (self._tunnel_host,
        self._tunnel_port))
    for header, value in self._tunnel_headers.iteritems():
        self.send("%s: %s\r\n" % (header, value))
    self.send("\r\n")
    <...>
s=requests.Session()
proxy_url=os.environ['HTTPS_PROXY']
s.proxies["https"]=proxy_url
# have to specify proxy here because env variable is only detected by httplib code
#while we need to trigger requests' proxy logic that acts earlier
# "https" means any https host. Since a Session persists cookies,
#it's meaningless to make requests to multiple hosts through it anyway.

pm=s.get_adapter("https://").proxy_manager_for(proxy_url)
pm.proxy_headers['Host']="host.com"
del pm,proxy_url
<...>
s.get('https://host.com')
Does Python requests really connect to http proxy?

Does Python requests really connect to http proxy?


By : Freespirit.sam
Date : March 29 2020, 07:55 AM
To fix the issue you can do You're setting an http proxy but making an https request. Set an https proxy instead (or in addition).
code :
import requests

proxies = {
  'http': 'http://10.10.1.10:3128',
  'https': 'http://10.10.1.10:1080',
}

requests.get('https://example.org', proxies=proxies)
>>> import requests
>>> requests.get('https://example.org', proxies={'https': 'http://asdasdasd:80'})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 67, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 53, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 437, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='example.org', port=443):
Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.',
NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at
0x7f3b880b9410>: Failed to establish a new connection: [Errno -2] Name or service not
known',)))
>>>
Cannot connect to proxy error on requests.get() or requests.post() in python

Cannot connect to proxy error on requests.get() or requests.post() in python


By : Emma From
Date : March 29 2020, 07:55 AM
With these it helps I was able to illicit a valid response for url2 when using headers keyword argument with User-Agent string set to Chrome.
code :
r2 = requests.get(url2, proxies=proxies, headers={'User-Agent': 'Chrome'})
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org