经过几个月的100%稳定后,今天我在Google地图服务上收到403错误 [英] After months of 100% stability, today I get 403 Error on google maps services

查看:217
本文介绍了经过几个月的100%稳定后,今天我在Google地图服务上收到403错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道是否有人可以解释为什么我看到我的谷歌地图服务的403 Forbidden错误。



我一直在加载地图API例如:

 < script type =text / javascriptsrc =// maps.googleapis.com/maps/api ?/ JS库=地方&放大器;放大器;传感器=假>< /脚本> 

然后使用地理编码和自动完成库将用户搜索转换为坐标以显示在在我的搜索结果中显示地图。



直到昨天为止,这个工作都很完美(几个月),每当自动完成服务被访问时我开始看到403错误。 b
$ b

我百分之百地确信我没有达到每天25k的查询限制,并且我没有对代码进行任何更改。



现在我已经在API密钥中添加了我的脚本加载,并且问题消失了,但我想确保这不会再发生。基于位置的搜索是我们网站的一个主要功能,如果它突破,我们会失去客户。



有人对此有何看法?



在什么情况下可以再次发生?

问题刚刚重新出现即使使用API​​密钥集 - 我认为问题实际上在于缓存Google地图javascript。



我有我的web服务器动态地决定要在本地混合,缩小和缓存的javascript。这是使用 RequestReduce 完成的。



当客户端JavaScript变得陈旧时(在我的情况下大约3天)< - em> - google会返回403未授权。



API密钥只是一个红鲱鱼。我可以删除密钥,我的代码仍然有效 - 只要地图js是新鲜的。



在我的情况下,修正是添加 maps.googleapis.com 添加到 RequestReduce 忽略列表中:

  javascriptUrlsToIgnore =maps.googleapis.com

对于其他人,只要确保不要将maps.googleapis.com javascript缓存超过几小时(如果有的话)。


I was just wondering if someone could shed some light on why I am seeing 403 Forbidden errors for my google maps services.

I had been loading the maps api as such:

<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?libraries=places&amp;sensor=false"></script>

And then using both the geocoding and autocomplete libraries to turn user searches into co-ordinates to display on a map on my search results.

This was working perfectly (for months) until yesterday, when I started seeing 403 Errors whenever the Autocomplete service was accessed.

I am 100% confident I wasn't reaching the 25k per day limit on queries, and I made no code changes on my side.

I have now added in an API key to my script load, and the problem dissapeared, but I want to be sure this doesn't happen again. Location based search is a main feature on our site, and if it breaks, we lose customers.

Does anyone have any insight as to why this may have happened?

And under what circumstances can it happen again?

解决方案

This problem just re-emerged even with an API key set - and I think the issue actually lies with caching the google maps javascript.

I have my web server dynamically decide what javascript to combine, minify and cache locally. This is done using RequestReduce.

When the client-side javascript becomes stale (roughly 3 days in my case) - google returns 403 unauthorized.

The API key was just a red herring. I can remove the key and my code still works - as long as the maps js is "fresh".

In my case, the fix was to add maps.googleapis.com to the RequestReduce ignore list:

javascriptUrlsToIgnore="maps.googleapis.com"

For others, just make sure to not cache the maps.googleapis.com javascript for more than a few hours, if at all.

这篇关于经过几个月的100%稳定后,今天我在Google地图服务上收到403错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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