Wildfly 16 在 NGINX 后面有 http-remoting:JBREM000202



我试图将Wildfly 16作为反向代理放在NGINX后面。我想使用 http-remoting 为 EJB 提供服务。

这是我的NGINX配置:

server {                                                                                                                             
listen          81;                                                                                                                
server_name     10.0.2.15;                                                                                                         
                                                               
location / {                                                                                                                       
                                                               
                                                               
set $should_proxy "";                                                                                                            
set $upgrade_header "";
if ($http_sec_jbossremoting_key) {
set $should_proxy "Y";
}
if ($should_proxy = Y) {
proxy_pass http://127.0.0.1:8080;
set $upgrade_header "upgrade";
}
proxy_set_header Sec-JbossRemoting-Key $http_sec_jbossremoting_key;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $http_host;
proxy_set_header Connection $upgrade_header;

}
}

但是,在 EJB 客户端上,我得到了

IOException: JBREM000202: Abrupt close on Remoting connection

我尝试获取NGINX生成的标头,并使用具有以下输出的tcpdump:

00:16:08.083162 IP (tos 0x0, ttl 64, id 34533, offset 0, flags [DF], proto TCP (6), length 185)
localhost.34890 > localhost.http-alt: Flags [P.], cksum 0xfead (incorrect -> 0x81b5), seq 1:134, ack 1, win 512, options [nop,nop,TS val 1104278851 ecr 1104278851], length 133: HTTP, length: 133
GET / HTTP/1.0
Sec-JbossRemoting-Key: iy2PuEO5anDKgm4w2+o0Tw==
Upgrade: jboss-remoting
Host: 10.0.2.15:81
Connection: upgrade
00:16:08.083165 IP (tos 0x0, ttl 64, id 42808, offset 0, flags [DF], proto TCP (6), length 52)
localhost.http-alt > localhost.34890: Flags [.], cksum 0xfe28 (incorrect -> 0x753d), ack 134, win 511, options [nop,nop,TS val 1104278851 ecr 1104278851], length 0
00:16:08.083690 IP (tos 0x0, ttl 64, id 42809, offset 0, flags [DF], proto TCP (6), length 227)
localhost.http-alt > localhost.34890: Flags [P.], cksum 0xfed7 (incorrect -> 0x1ada), seq 1:176, ack 134, win 512, options [nop,nop,TS val 1104278852 ecr 1104278851], length 175: HTTP, length: 175
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: jboss-remoting
Sec-JbossRemoting-Accept: ofI3qxa1miPoq1vhp3tDCO5r/kw=
Date: Sat, 20 Jun 2020 22:16:08 GMT

与直接发送到Wildfly的请求相比,它们看起来相同。我不知道如何进一步调试它。

知道我可能做错了什么吗?

这是我的nginx配置的样子,它的工作原理:

location / {
proxy_pass              http://127.0.0.6:9990;
proxy_http_version      1.1;
proxy_set_header        X-Real-IP $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header        Host $http_host;
proxy_set_header        X-Forwarded-Proto $scheme;
proxy_set_header        X-Frame-Options SAMEORIGIN;
#for proxying wildfly
proxy_set_header sec_jbossremoting_key $http_sec_jbossremoting_key;
proxy_set_header sec_hornetqremoting_key $http_sec_hornetqremoting_key;
proxy_set_header upgrade $http_upgrade;
proxy_set_header connection "upgrade";
proxy_set_header host $http_host;
}

可以通过执行jboss-cli.sh脚本进行调试,并查看是否可以连接。

首先,尝试直接向野蝇发送请求,在我的例子中是 127.0.0.6:9990

[user@server]# /opt/wildfly/bin/jboss-cli.sh --controller=127.0.0.6:9990 --connect
[standalone@127.0.0.6:9990 /] version
JBoss Admin Command-line Interface

比,尝试通过nginx连接,在我的情况下是172.16.20.11:9990

[user@server]# /opt/wildfly-8.2.1.Final/bin/jboss-cli.sh --controller=172.16.20.11:9990 --connect
[standalone@172.16.20.11:9990 /] version

运行脚本将显示您在其中遇到的错误类型,而不是nginx:)

最新更新