Welcome! Log In Create A New Profile

Advanced

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Кирюшкин Владимир
October 26, 2011 11:50AM
Hello,

during applying the patch i've got these warnings:

# patch mini_httpd.c -i realip.patch
patching file mini_httpd.c
patching file mini_httpd.c
Hunk #1 FAILED at 27.
Hunk #2 FAILED at 163.
2 out of 2 hunks FAILED -- saving rejects to file mini_httpd.c.rej

so i've added failed hunks manually.
after installing and configuring i've checked the output from env-script, but REMOTE_ADDR still was 127.0.0.1.
also when i'm requesting that script without any additional headers, it's ok, but when i add "X-Real-IP" it looks like mini-httpd just closes the connection:

# curl -H 'X-Real-IP: 127.0.0.2' http://127.0.0.1:8000/index.cgi
curl: (52) Empty reply from server

then i've changed "X-Real-IP" to "X-Forwarded-For" in mini_httpd.c:

else if ( strncasecmp( line, "X-Forwarded-For:", 16 ) == 0 )
{
if ( strcmp(remote_addr, xrealip ) == 0 )
{
cp = &line[16];
cp += strspn( cp, " \t" );
remote_addr = cp;
}
}

and after compiling there is same result:

# curl -H 'X-Forwarded-For: 127.0.0.2' http://127.0.0.1:8000/index.cgi
curl: (52) Empty reply from server

with no additional headers script works ok.

Could you please suggest me any other way to run cgi programs with nginx, but with getting real IPs from clients, not "127.0.0.1"?
using apache httpd as backend will be huge performance impact.
Thanks in advance.


Cheers,

Vladimir

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx and thttpd + cgi, remote_addr = 127.0.0.1

Кирюшкин Владимир October 25, 2011 05:12PM

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Francis Daly October 25, 2011 06:12PM

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Кирюшкин Владимир October 25, 2011 06:18PM

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Aleksandar Lazic October 25, 2011 06:42PM

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Francis Daly October 26, 2011 09:04AM

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Кирюшкин Владимир October 26, 2011 10:34AM

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Igor Sysoev October 26, 2011 10:28AM

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Кирюшкин Владимир October 26, 2011 11:50AM

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Aleksandar Lazic October 26, 2011 11:52AM

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Кирюшкин Владимир October 26, 2011 04:38PM

Re: nginx and thttpd + cgi, remote_addr = 127.0.0.1

Aleksandar Lazic October 26, 2011 05:04PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 306
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