Welcome! Log In Create A New Profile

Advanced

CONNECT request method handling FAILED, help needed

Posted by skywalker 
CONNECT request method handling FAILED, help needed
April 28, 2010 08:53AM
Hi,

here's the scenario:
since nginx doesn't support forward proxy, I wanted to make it to handle forward proxy requests by using third party proxy server and some Nginx configuration. I make it out for GET and POST request, but for CONNECT request there was no chance.

I wanted to configure my Nginx web-server to recognize CONNECT request and bypass it to the proxy server. I used this config:

[code]

if ($request_method ~ ^CONNECT$ ) {
proxy_pass http://127.0.0.1:8080;
}

[/code]

but I always got 400 bad request error, I even tried just to change the error code and replace proxy_pass directive with "return 444" but nothing changes, the error occurs before nginx parse the configuration file.

here is my request and response headers:

[code]
CONNECT mail.google.com:443 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Proxy-Connection: keep-alive
Host: mail.google.com


<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/0.7.65</center>
</body>


</html>
[/code]


I would appreciate you reply and responses, and I hope someone may offer a solution for this problem, or a modification in nginx source code so I can make this scenario works.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 270
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready