Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs $http强制请求删除www_Angularjs_Http_Angular Http - Fatal编程技术网

Angularjs $http强制请求删除www

Angularjs $http强制请求删除www,angularjs,http,angular-http,Angularjs,Http,Angular Http,我正在尝试向发送一个角度$http请求 https://www.myproject.com/users/123 使用 然而,Chrome的控制台说 获取网络::错误\u名称\u未\u解析 该应用程序似乎正在迫使https变成http,并将www全部删除 为什么会这样?如何停止这种行为?使用相对urlvar usersURL=“///www.myproject.com/users/”+“123”这将帮助您我们如何告诉您为什么您的服务器对此URL响应404以及正确的URL应该是什么?这取决于服务器

我正在尝试向发送一个角度
$http
请求

https://www.myproject.com/users/123
使用

然而,Chrome的控制台说

获取网络::错误\u名称\u未\u解析

该应用程序似乎正在迫使
https
变成
http
,并将
www
全部删除


为什么会这样?如何停止这种行为?

使用相对url
var usersURL=“///www.myproject.com/users/”+“123”这将帮助您我们如何告诉您为什么您的服务器对此URL响应404以及正确的URL应该是什么?这取决于服务器及其数据库,与angular无关。为什么您从404推断您需要使用http而不是https,并从主机名中删除www?@JBNizet我完全确定服务器需要
htts://www
。已经过测试了。问题是,为什么Angular不在那里发送请求?它确实发送了请求。否则,你怎么会有404响应呢?如果不发送请求,您将无法获得响应。用户123存在吗?如果将此URL粘贴到浏览器的地址栏中会发生什么情况?@JBNizet在浏览器中,我得到一个JSON对象,其中包含预期的数据
var usersURL = "https://www.myproject.com/users/" + "123";
            return {
                execute: function(){
                    return $http({
                        method: 'GET',
                        url: usersURL
                    });

                }
            };
        }