Google Maps Geocoding API中的CORS错误

纽特

我面临一个相当突然的Google Maps Geocoding问题。到昨天为止一切都很好,但是从那时起,我对他们的Geocoding API的任何请求都收到了CORS错误。

我的请求:

https://maps.googleapis.com/maps/api/geocode/json?latlng=18.92187618976372,72.82581567764282&key=<API_KEY>

我的请求标头:

Provisional headers are shown
Accept:application/json, text/plain, */*
Origin:http://domain
Referer:http://domain/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36
X-FirePHP-Version:0.0.6

响应头:

access-control-allow-origin:*
alternate-protocol:443:quic,p=1
cache-control:public, max-age=86400
content-encoding:gzip
content-length:1279
content-type:application/json; charset=UTF-8
date:Thu, 23 Jul 2015 09:50:49 GMT
expires:Fri, 24 Jul 2015 09:50:49 GMT
server:mafe
status:200
vary:Accept-Language
x-frame-options:SAMEORIGIN
x-xss-protection:1; mode=block

错误信息:

XMLHttpRequest cannot load https://maps.googleapis.com/maps/api/geocode/json?latlng=18.92187618976372,72.82581567764282&key=<API_KEY>. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://domain' is therefore not allowed access.
纽特

系统的设置方式是让我的前端从逻辑服务器的跨域提供服务。为此,我将withCredentials标志设置true由于Maps的API使用*通配符,withCredentials因此出现错误。

为了解决这个问题,我对Maps调用使用了单独的XHR方法,其中标志设置为false。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Google Maps Geocoding的API密钥

来自分类Dev

每秒Google Maps Geocoding API的配额限制与文档不匹配

来自分类Dev

Google Maps Geocoding不起作用

来自分类Dev

使用Google Maps JavaScript API v3和Geocoding API映射多个位置

来自分类Dev

将许多请求发送到Google Maps Geocoding API的正确方法是什么?

来自分类Dev

Google Geocoding Without API Key

来自分类Dev

使用Google Geocoding API进行VBA编程

来自分类Dev

使用@ react-google-maps / api的CORS错误

来自分类Dev

Google Geocoding API返回错误的语言作为响应

来自分类Dev

错误:Google Maps API错误

来自分类Dev

Perl中的Google Maps API错误

来自分类Dev

Google 地图 API/Geocoding Uncaught ReferenceError: google is not defined

来自分类Dev

Google Maps API密钥错误

来自分类Dev

如何使用Mockito / Powermock模拟Google的Geocoding API请求?

来自分类Dev

使用jQuery从Google Geocoding API读取JSON数据

来自分类Dev

Google Geocoding API不再每次都显示地区

来自分类Dev

Google Maps中的未知错误

来自分类Dev

C#中的Google Geocoding Json解析问题

来自分类Dev

C#中的Google Geocoding Json解析问题

来自分类Dev

Google Maps API RefererNotAllowedError

来自分类Dev

Google Maps API DeletedApiProjectMapError

来自分类Dev

Google Maps Api许可

来自分类Dev

Google Maps Api

来自分类Dev

Google Maps REST API

来自分类Dev

Google Maps API请求

来自分类Dev

Google Maps Directions API

来自分类Dev

Google Maps API参数

来自分类Dev

来自Google Maps API的角度指令中的错误

来自分类Dev

如何在HERE Maps Geocoding and Search API v7中为反向Geocode端点指定搜索半径?