Skip to content

Instantly share code, notes, and snippets.

@cristianmiranda
Last active July 3, 2017 15:19
Show Gist options
  • Select an option

  • Save cristianmiranda/674b25815e2200ba4ed7ae9b0ef4df0c to your computer and use it in GitHub Desktop.

Select an option

Save cristianmiranda/674b25815e2200ba4ed7ae9b0ef4df0c to your computer and use it in GitHub Desktop.
Proxies.md

Proxies

If you specify a proxy option, then the request (and any subsequent redirects) will be sent via a connection to the proxy server. Si especificas una opcin de proxy, entonces el request (y cualquier otro redirect subsecuente) será enviado a través de una conexin al servidor proxy.

If your endpoint is an https url, and you are using a proxy, then request will send a CONNECT request to the proxy server first, and then use the supplied connection to connect to the endpoint. Si tu endpoint es una url con https, y ests usando un proxy, entonces el request enviará un CONNECT request al servidor proxy primero, y luego usará la conexión provista para conectarse al endpoint

That is, first it will make a request like: Es decir, primero har un request como el siguiente:

HTTP/1.1 CONNECT endpoint-server.com:80
Host: proxy-server.com
User-Agent: whatever user agent you specify

and then the proxy server make a TCP connection to endpoint-server on port 80, and return a response that looks like: y luego, el servidor proxy hace una conexin TCP al endpoint-server en el puerto 80, y devuelve la respuesta como la siguiente:

HTTP/1.1 200 OK

At this point, the connection is left open, and the client is communicating directly with the endpoint-server.com machine. En este punto, la conexión permanece abierta, y el cliente se está comunicando directamente con la máquina endpoint-server.com

See the wikipedia page on HTTP Tunneling for more information. Ver la página en wikipedia acerca de HTTP Tunneling para mas informacion

By default, when proxying http traffic, request will simply make a standard proxied http request. This is done by making the url section of the initial line of the request a fully qualified url to the endpoint. Por defecto, cuando se proxeea (si, no se como traducirlo jaja) el tráfico http, los request serán un request http proxeado standard. Esto es logrado haciendo que la sección url de la linea inicial del request sea una url completamente calificada para el endpoint

For example, it will make a single request that looks like: Por ejemplo, hará un simple request que se parece a esto:

HTTP/1.1 GET http://endpoint-server.com/some-url
Host: proxy-server.com
Other-Headers: all go here

request body or whatever

Because a pure "http over http" tunnel offers no additional security or other features, it is generally simpler to go with a straightforward HTTP proxy in this case. However, if you would like to force a tunneling proxy, you may set the tunnel option to true. Porque un tunel "http sobre http" puro no ofrece seguridad adicional o ninguna otra feature, es generalmente más simple ir con un proxy HTTP directo en este caso. Sin embargo, si quisieras ofrecer tunneling proxy, deberías setear la opción de tunnel en true

You can also make a standard proxied http request by explicitly setting tunnel : false, but note that this will allow the proxy to see the traffic to/from the destination server. También podes hacer un request http standard proxeado, explicitamente setando tunnel en false, pero nota que esto también permitirá al proxy ver el tráfico de/hacia el server destino.

If you are using a tunneling proxy, you may set the proxyHeaderWhiteList to share certain headers with the proxy. Si estás usando un tunneling proxy, podes setear el proxyHeaderWhiteList para compartir ciertos headers con el proxy

You can also set the proxyHeaderExclusiveList to share certain headers only with the proxy and not with destination host. Podes también setear el proxyHeaderExclusiveList para compartir ciertos headers solo para el proxy y no con el host destino

By default, this set is: Por defecto, esta lista es:

accept
accept-charset
accept-encoding
accept-language
accept-ranges
cache-control
content-encoding
content-language
content-length
content-location
content-md5
content-range
content-type
connection
date
expect
max-forwards
pragma
proxy-authorization
referer
te
transfer-encoding
user-agent
via
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment