i have a production server which has a nginx server to handle connection to several services. In other machine which is only visible through a VPN from the production server, I have a development server which is used to test some networks application.
I want to reach services provided for the开发者_开发技巧 development machine from internet, so I need to forward the incomming traffic to the development server
1.- Client request using socket connection to a.domain.com (Port 7081)
2.- nginx must forward this, I have the following code for that
Note: a.domain.com has a VPN interface at 10.8.0.1
server {
listen 7081;
server_name a.domain.com;
location / {
proxy_pass http://10.8.0.210:7081;
proxy_set_header X-Real-IP $remote_addr;
}
}
3.- In the development server (10.8.0.210) I have a service listining in port 7081.
The socket connection from client returned the following
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/0.6.35</center>
</body>
</html>
4.- nginx server at a.domain.com logged the following
XXX.XXX.XX.XX - - [11/Feb/2011:08:58:10 -0300] "-" 400 173 "-" "-"
Any ideas
thank you
Bad request -- means, that it is not http request.
Nginx can proxy only http/smtp/pop3/imap protocols.
If you want to proxy anything else, you must use for example DNAT in iptables
精彩评论