我正在尝试为位于负载平衡器后面的JBoss Application Server编写一些检查。当前的检查与测试用户登录到网站,输出数据,然后我们交叉检查特定的字符串。
无论如何,我本质上都想做同样的事情,但是在节点级别,所以我一直在玩wget,但是不断出现400错误。
我附上了当我从具有Internet访问权限的主机上通过负载平衡器进行检查时可以使用的支票。
/usr/bin/wget --post-data 'username=<user>&password=<passwd>' --no-check-certificate --load-cookies ${TMPDIR}/cookies1.$$ --save-cookies ${TMPDIR}/cookies2.$$ --keep-session-cookies --header='Referer: https://www.example.com.uk/cs8/content/secure/my_homepage.jsp' --output-document ${TMPDIR}/doc2.$$ https://www.example.com.uk/cs8/content/secure/j_security_check
--2019-03-25 12:00:54-- https://www.example.com.uk/cs8/content/secure/j_security_check
Resolving www.example.com.uk... VIP1, VIP2
Connecting to www.example.com.uk|VIP1|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://www.example.com.uk/cs8/content/secure/my_homepage.jsp [following]
--2019-03-25 12:00:54-- https://www.example.com.uk/cs8/content/secure/my_homepage.jsp
Connecting to www.example.com.uk|VIP1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6049 (5.9K) [text/html]
Saving to: `/tmp/check_cs8/doc2.5965'
这是直接在其中一个节点上运行时失败的代码。
/usr/bin/wget --post-data 'username=<user>&password=<passwd>' --no-check-certificate --load-cookies ${TMPDIR}/cookies1.$$ --save-cookies ${TMPDIR}/cookies2.$$ --keep-session-cookies --header='Referer: http://${IP}:${PORT}/cs8/content/secure/my_homepage.jsp' --output-document ${TMPDIR}/doc2.$$ http://${IP}:${PORT}/cs8/content/secure/j_security_check
--2019-03-25 13:48:27-- http://{IP}:8080/cs8/content/secure/j_security_check
Connecting to {IP}:8080... connected.
HTTP request sent, awaiting response... 400 Invalid direct reference to form login page
2019-03-25 13:48:27 ERROR 400: Invalid direct reference to form login page.