Search squid archive

Re: POST request to literal IP address gives 301 instead of 200

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17/10/2013 12:39 a.m., Dick Visser wrote:
Hi guys

I'm trying to get an HTTP request to pass through but it seems Squid
is generating a redirect.
With curl the request works fine if I don't use our proxy:

visser@lenin:~$ curl -vv --noproxy '*' --header 'Host:
rest.akismet.com' --data
'key=aaaaaaaaaaaa&blog=https%3A%2F%2Fblog.refeds.org'
http://66.135.58.61/1.1/verify-key
* About to connect() to 66.135.58.61 port 80 (#0)
*   Trying 66.135.58.61... connected
* Connected to 66.135.58.61 (66.135.58.61) port 80 (#0)
POST /1.1/verify-key HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
Accept: */*
Host: rest.akismet.com
Content-Length: 51
Content-Type: application/x-www-form-urlencoded

< HTTP/1.1 200 OK
< Server: nginx
< Date: Wed, 16 Oct 2013 11:25:29 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 7
< Connection: close
< X-akismet-server: 192.168.6.135
<
* Closing connection #0


When sent through Squid, the same request gives a redirect (301):

* About to connect() to proxy proxy6.terena.org port 80 (#0)
*   Trying 2001:610:148:dead::20... connected
* Connected to proxy6.terena.org (2001:610:148:dead::20) port 80 (#0)
POST http://66.135.58.61/1.1/verify-key HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
Accept: */*
Proxy-Connection: Keep-Alive
Host: rest.akismet.com
Content-Length: 51
Content-Type: application/x-www-form-urlencoded

In HTTP the client->proxy and client->server HTP syntax is very different. In this case the Host: header is the important part. Host: header is not relevant on cleint->proxy traffic since the URL contains the desired server hostname.

The request leaving the proxy will look something like this:

POST /1.1/verify-key HTTP/1.0
Host: 66.135.58.61
User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
Accept: */*
Connection: keep-alive
Content-Length: 51
Content-Type: application/x-www-form-urlencoded

... followed by some HTTP header mandatory for the proxy add and some additional debug ones Squid adds.

Now. The server identifies the raw-IP access attempt and redirects the client to try again with the host name "akismet.com".

Amos




[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux