自定义标记缺失...有时 [英] Custom marker missing ... sometimes

查看:77
本文介绍了自定义标记缺失...有时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用的是静态google maps API,当突然突然开始出现我们的自定义标记图标引起的麻烦时,情况就很好了.有时它会按预期显示,有时我们会以默认标记和右上角的黄色横幅结尾,上面写着:地图错误:g.co/staticmaperror".

We're using the static google maps API and things were going fine when suddenly it started getting hiccups with our custom marker icon. Sometimes it get's displayed as intended, sometimes we end up with the default marker and the yellow banner in the upper right corner stating: "Map error: g.co/staticmaperror".

看看标题,我们发现Google似乎在获取标记图像时遇到问题:

Taking a look at the headers we found that google seems to have issues fetching our marker image:

x-staticmap-api-warning: Failed to fetch image url https://www.xyz.de/some_image.png

我可以激发相同的请求n次,并得到一些m< = n很好的响应和一些o< = n具有上述问题的请求.在我看来,谷歌在缓存图片时遇到了一些问题.
不过,从我们的服务器请求标记图片没有问题.没有可触发的防火墙规则.标记图像具有较高的 cache-control max-age 和良好的 etag ,它从现在起两周后到期.没什么好想的.

I can fire the very same request n times and get some m <= n responses that are fine and some o <= n requests that have the above mentioned issue. This seems to me like google has some issues caching the image.
I have no issues requesting the marker image from our servers, though. There are no firewall rules that fire. The marker image has a high cache-control max-age and a fine etag, it expires two weeks from now. There's nothing fancy about it.

地图请求如下所示:

https://maps.googleapis.com/maps/api/staticmap?key=<OUR_KEY>&size=260x130&maptype=roadmap&format=png&visual_refresh=true&zoom=10&markers=icon:https://www.xyz.de/some_image.png|52.52008961%2C13.40465566&signature=<SIG>

这里也没有幻想.

由于SO似乎现在已成为Google的官方支持,请某些Google技术人员提供帮助吗?

Since SO seems to be the official google support now, may some google techie please help?

推荐答案

事实证明,我们的应用程序防火墙实际上阻止了来自Google的某些请求,因此我们必须添加更多规则.(尽管我们认为我们已经检查了两次.)

As it turns out our application firewall actually blocked some requests from Google and we have to add some more rules. (Although we think we checked that twice already.)

遗憾的是,地图服务没有固定的IP范围.但是,让我与您分享支持人员告诉我的内容:

Sadly, there's no fixed IP range for the maps services. But let me share with you what the support told me:

Google Cloud支持

Google Cloud Support

由于Google服务未绑定到我们数据中心中的特定主机或IP地址,因此无法提供使用Maps API必须访问的IP地址的特定列表.

It is not possible to provide a specific list of IP addresses that must be accessible in order to use the Maps APIs, because Google services are not tied to specific hosts or IP addresses in our data centers.

服务会根据负载,维护计划和增长情况在数据中心之间迁移.特定请求路由到的特定数据中心取决于用户的地理位置,网络位置以及当前托管有关服务的附近数据中心以及连接它们的网络链接上的相对负载.

Services are migrated between data centers depending on load, maintenance schedules, and growth. The particular data center that a specific request is routed to depends on the user's geographical location, network location, and the relative load on nearby data centers currently hosting the service concerned, and on the network links that connect them.

如果您需要添加基于IP的防火墙规则,则唯一的选择是将Google的整个网络分配列入白名单,这可以使用以下命令从Unix系统中获得:

If you need to add IP based firewall rules, your only option is to whitelist Google's entire network allocation, which can be obtained using the following command from a Unix system:

$ dig +short _spf.google.com txt

答案将包含一些文本,例如:

The answer will include some text like:

"v=spf1 include:_netblocks.google.com include:_netblocks2.google.com include:_netblocks3.google.com ~all"

对于所有网络块,请务必遵循包含内容.

Be sure to follow the includes for all the netblocks e.g.

$ dig +short _netblocks.google.com txt

$ dig +short _netblocks2.google.com txt

$ dig +short _netblocks3.google.com txt

答案部分以CIDR标记列出了所有IP地址块.

The answer section lists all IP address blocks in CIDR notation.

此列表每年随着服务器的添加和删除而更改几次,因此您有责任跟踪这些更改并相应地更新防火墙.(我们建议您每季度这样做一次.)

This list changes several times a year as servers are added and removed, and it is your responsibility to track those changes and update your firewall accordingly. (We recommend that you do so every quarter).

通常,根据Maps API使用的主机名列表设置防火墙规则要容易得多,

In general it is much easier to set firewall rules based on the list of hostnames used by the Maps API, which is more stable.


修复的另一种方法是对此静态资源(标记图标)设置例外.


Another way to fix this would be to make an exception for this static resource (the marker icon).

这篇关于自定义标记缺失...有时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆