Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: HTTP 400 Bad Request #5

Open
SjRNMzU opened this issue Oct 26, 2016 · 3 comments
Open

Bug: HTTP 400 Bad Request #5

SjRNMzU opened this issue Oct 26, 2016 · 3 comments

Comments

@SjRNMzU
Copy link

SjRNMzU commented Oct 26, 2016

Hi, I'm using the socks plugin to route a request via a socks proxy. I have tried a simple loopback i.e. request example.com -> (socks proxy) -> example.com

Request example.com resolves to machine A and connects to nginx
SOCKS5 proxy listening at localhost:xxx on machine A, connected to machine B.
Request is routed via the SOCKS5 proxy but when trying to do the HTTP request I get HTTP 400 error.

Here's the access log:
"GET\x00/IJKT_QHYF/index.php/DGH_Wiki/ HTTP/1.1" 400 173 "-" "-"

as apposed to a normal request directly to example.com (machine A):

"GET /IJKT_QHYF/index.php/DGH_Wiki/ HTTP/1.1" 401 597 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"

As you can see the HTTP headers are garbled with \x00 encoded between GET and the location.

@SjRNMzU
Copy link
Author

SjRNMzU commented Oct 26, 2016

Config

location / {
    socks_pass socks5://127.0.0.1:/65432;
    socks_set_host $MY_HOSTNAME;
    socks_set_header HOST $MY_HOSTNAME;
    socks_redirect off;
}

@dannote
Copy link
Owner

dannote commented Oct 31, 2016

Thank you for your report! That's very strange. I'll check it out once I finish some refactoring.

@dannote
Copy link
Owner

dannote commented Nov 17, 2016

Please try setting socks_http_version to 1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants