收藏
回答

微信内置浏览器无法发送ajax请求

其他浏览器可发送ajax请求,微信浏览器无法发送ajax请求

ajax返回错误如下:

{"readyState":4,"responseText":"You are not allowed to access this file. Check app_dev.php for more information.","status":403,"statusText":"error"}


说我app_dev.php权限有问题!可是其他浏览器都能正常访问!


这是nginx请求信息

127.0.0.1 - - [16/Nov/2018:11:19:06 +0800] "POST /v1/checkorder/uploadPaper HTTP/1.1" 403 91 "http://b1.s1.natapp.cc/check/submit" "Mozilla/5.0 (Linux; Android 8.0; STF-AL10 Build/HUAWEISTF-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044306 Mobile Safari/537.36 MMWEBID/5928 MicroMessenger/6.7.3.1360(0x26070339) NetType/WIFI Language/zh_CN Process/tools"


最后一次编辑于  2018-11-16
回答关注问题邀请回答
收藏

1 个回答

  • outstanding
    outstanding
    2018-11-16

    问已解决,是因为symfony 测试入口app_dev.php

    if (isset($_SERVER['HTTP_CLIENT_IP'])
       || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
       || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'], true) || PHP_SAPI === 'cli-server')
    ) {
       header('HTTP/1.0 403 Forbidden');
       exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
    }

    这段代码的原因!注释掉就好了!

    2018-11-16
    赞同
    回复