Wildfly 16 with http-remoting 落后于 NGINX:JBREM000202
Wildfly 16 with http-remoting behind NGINX: 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 生成的 headers 并使用 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脚本来调试,看看能不能连上
首先尝试直接向wildfly发送请求,我这里是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 :)
我试图将 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 生成的 headers 并使用 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脚本来调试,看看能不能连上
首先尝试直接向wildfly发送请求,我这里是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 :)