Angular 角度6:Http故障响应(Microsoft Edge)

Angular 角度6:Http故障响应(Microsoft Edge),angular,microsoft-edge,Angular,Microsoft Edge,我正在尝试调用API,但是在使用m Edge时我遇到了一些问题(Chrome、IE和Firefox都可以)。对于我尝试执行的每个请求,控制台中都会出现以下错误: 这是我的服务: @Injectable({ providedIn: 'root' }) export class AuthService { constructor(private http: HttpClient) {} signup( firstName: string, last

我正在尝试调用API,但是在使用m Edge时我遇到了一些问题(Chrome、IE和Firefox都可以)。对于我尝试执行的每个请求,控制台中都会出现以下错误:

这是我的服务:

@Injectable({ providedIn: 'root' })
export class AuthService {
    constructor(private http: HttpClient) {}

    signup(
        firstName: string,
        lastName: string,
        email: string,
        country: string,
        password: string
    ) {
        const data = {
            firstName: firstName,
            lastName: lastName
        };

        const headers = new HttpHeaders({
            'Content-Type': 'application/json; charset=utf-8'
        });

        return this.http.post('https://api.lan/new/', data, {
            headers: headers,
            observe: 'response'
        });
    }
} 
API Nginx配置:

server {
    listen 80;
    listen [::]:80;

    server_name     visionapi-dev.arkadin.lan;

    root            /var/www/online-vision-api/httpdocs;
    error_log   /var/www/online-vision-api/logs/error_log;
    access_log      /var/www/online-vision-api/logs/access_log;
    index           index.php;

    add_header 'Access-Control-Allow-Origin' '*' always;
    add_header 'Access-Control-Allow_Credentials' 'true' always;
    add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range' always;
    add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH' always;

    location / {
            if ($request_method = 'OPTIONS') {
                    add_header 'Access-Control-Allow-Origin' '*' always;
                    add_header 'Access-Control-Allow_Credentials' 'true' always;
                    add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range' always;
                    add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH' always;
                    add_header 'Access-Control-Max-Age' 1728000 always;
                    add_header 'Content-Length' 0 always;
                    return 204;
            }
            # Check if a file or directory index file exists, else route it to index.php.
            try_files $uri $uri/ /index.php;
    }

    location ~ \.php$ {
            include snippets/fastcgi-php.conf;

            fastcgi_pass                    unix:/var/run/php/php7.0-fpm.sock;
            fastcgi_param                   SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_read_timeout    180;
    }
}
我已经疯狂地搜索了,有人知道吗


谢谢

Http失败响应(未知url):0未知错误看起来您有CORS问题。那么,您只在Edge中获得错误消息?如果删除这些错误消息,是否有效?在请求post方法{headers:headers中的attribute,注意:'response'}。你能在开发工具中提供一些关于“网络”选项卡的信息吗?或者根本没有启动请求?嘿@xrobert35,删除标题的结果相同。当使用Edge时,请求甚至不会出现在网络选项卡下。嘿@Kedenk,是的,它只发生在Edge上。但是,我认为这是一个CORS问题。您有权访问服务器源代码吗?是否可以添加
访问控制允许原点
标题?