开发者

Socket connection through nginx

开发者 https://www.devze.com 2023-02-10 11:23 出处:网络
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 serv

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号