Https Debian服务器上的wget得到302,而Manjaro服务器上的wget得到200 OK
我正在使用wget从URL检索Instagram JSON 从本地Manjaro设置运行wget将返回Https Debian服务器上的wget得到302,而Manjaro服务器上的wget得到200 OK,https,debian,wget,Https,Debian,Wget,我正在使用wget从URL检索Instagram JSON 从本地Manjaro设置运行wget将返回200OK和正确的JSON响应,但从Debian服务器运行wget将检索找到的302 起初我认为这可能是因为wget版本的不同,但在wget不能正常工作的情况下,本地运行curl也可以工作 我应该在我的服务器上设置什么来获得正确的响应吗?我的猜测是HTTPS连接拒绝了我的服务器正确连接。所以,这是Instagram服务器的一个奇怪的怪癖。你对此无能为力 问题在于Instagram的响应不同,这取
200OK
和正确的JSON响应,但从Debian服务器运行wget将检索找到的302
起初我认为这可能是因为wget版本的不同,但在wget不能正常工作的情况下,本地运行curl也可以工作
我应该在我的服务器上设置什么来获得正确的响应吗?我的猜测是HTTPS连接拒绝了我的服务器正确连接。所以,这是Instagram服务器的一个奇怪的怪癖。你对此无能为力 问题在于Instagram的响应不同,这取决于您是通过IPv4还是IPv6连接到他们的服务器。我无法理解他们为什么会这样做,但我可以通过只控制这个变量来可靠地再现结果 IPv4: IPv6: 这与您在调试日志中看到的相同。在Manjaro上,它建立了IPv4连接,而在Debian上,它建立了IPv6连接,从而导致了这些差异。 欢迎来到疯狂网络服务器的世界:)
在任何情况下,您的问题的答案都是只使用IPv4连接,通过在Chrome中加载URL并复制cURL请求并在服务器上运行,我能够得到正确的响应,但这似乎更像是一种解决方法?非常有趣。请尝试使用
--debug
开关运行Wget并共享输出。我很想看看有什么不同are@darnir不知道--debug
参数!我已在两个系统上运行了该命令:
$ wget -O/dev/null -4 "https://www.instagram.com/instagram/?__a=1"
--2020-09-03 14:22:15-- https://www.instagram.com/instagram/?__a=1
Resolving www.instagram.com (www.instagram.com)... 157.240.27.174
Connecting to www.instagram.com (www.instagram.com)|157.240.27.174|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 118552 (116K) [application/json]
Saving to: ‘/dev/null’
100%[================================================================================================================================>] 118,552 306KB/s in 0.4s
2020-09-03 14:22:17 (306 KB/s) - ‘/dev/null’ saved [118552/118552]
$ wget -O/dev/null -6 "https://www.instagram.com/instagram/?__a=1"
--2020-09-03 14:22:54-- https://www.instagram.com/instagram/?__a=1
Resolving www.instagram.com (www.instagram.com)... 2a03:2880:f23f:e5:face:b00c:0:4420
Connecting to www.instagram.com (www.instagram.com)|2a03:2880:f23f:e5:face:b00c:0:4420|:443... connected.
HTTP request sent, awaiting response... 302 Found
Cookie coming from www.instagram.com attempted to set domain to www.instagram.com
Cookie coming from www.instagram.com attempted to set domain to www.instagram.com
Location: https://www.instagram.com/accounts/login/?next=/instagram/%3F__a%3D1 [following]
--2020-09-03 14:22:54-- https://www.instagram.com/accounts/login/?next=/instagram/%3F__a%3D1
Reusing existing connection to [www.instagram.com]:443.
HTTP request sent, awaiting response... 200 OK
Cookie coming from www.instagram.com attempted to set domain to www.instagram.com
Cookie coming from www.instagram.com attempted to set domain to www.instagram.com
Length: 48094 (47K) [text/html]
Saving to: ‘/dev/null’
100%[================================================================================================================================>] 48,094 --.-K/s in 0.04s
2020-09-03 14:22:54 (1.28 MB/s) - ‘/dev/null’ saved [48094/48094]