计算机阻止CORS选项请求

时间:2013-11-22 13:45:58

标签: http networking cors

这让我抓狂!我正在尝试使用Amazon S3 CORS请求,但他们无法在我的计算机上运行。我的计算机似乎阻止或忽略了OPTIONS请求。如果我从终端运行CURL命令:

curl -i -X OPTIONS http://testing.bennadel.com.s3.amazonaws.com

......我明白了:

curl:(52)来自服务器的空回复

但是,如果我在相同的路由器上的另一台计算机(AirBook)上运行相同的请求,我会得到预期的响应(以XML格式):

信息不足。需要原始请求标题。

我试过刷新我的dsn缓存(通过dscacheutil)。我已尝试更改DNS以使用Google的公共DNS。我试过重新启动电脑。没运气!这台计算机不断阻止OPTIONS请求,我尝试的每台其他计算机都允许它。

连连呢?这台电脑(iMac)通过WiFi连接到我的路由器;但是,AirBook也是如此,它提出了成功的OPTIONS请求。

另请注意,对同一URL的非OPTIONS请求可以正常工作(即GET)。

2 个答案:

答案 0 :(得分:8)

更具体地说,问题似乎出现在AnyConnect的Web安全模块中。通过卸载并重新安装AnyConnect,并且未选中Web Security选项,我能够解决问题。或者,只需运行websecurity_uninstall.sh脚本即可。 (这与AnyConnect 3.1.04074有关。)

感谢@ user3021922和其他人发现问题 - 这也让我发疯了。

答案 1 :(得分:0)

问题是Cisco AnyConnect的网络安全模块。在我们的例子中,我们无法卸载AnyConnect或对其进行任何更改(大型企业设置,其中更改将非常昂贵/耗时)。幸运的是,似乎有两种解决方案可行。

  1. 思科只阻止端口 # 1.To use URL Alias you need to be running apache with mod_rewrite enabled. # 2. In your opencart directory rename htaccess.txt to .htaccess. # For any support issues please visit: http://www.opencart.com Options +FollowSymlinks # Prevent Directoy listing Options -Indexes # Prevent Direct Access to files <FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))"> Order deny,allow Deny from all </FilesMatch> # SEO URL Settings RewriteEngine On # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ # RewriteBase / RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] RewriteRule ^system/download/(.*) /index.php?route=error/not_found [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css) RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] ### Additional Settings that may need to be enabled for some servers ### Uncomment the commands by removing the # sign in front of it. ### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that. # 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it: # php_flag register_globals off # 2. If your cart has magic quotes enabled, This may work to disable it: # php_flag magic_quotes_gpc Off # 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try # php_value upload_max_filesize 999M # 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields # php_value post_max_size 999M # 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields # php_value max_execution_time 200 # 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields # php_value max_input_time 200 # 7. disable open_basedir limitations # php_admin_value open_basedir none 80(其他端口似乎正常)。
  2. 思科允许安全8080请求。
  3. 因此,如果您可以控制服务器,请将其放在不同的端口或使用https,您的用户就可以了。