Google Geocode API凭证在URL上无法正常工作。

huangapple go评论53阅读模式
英文:

Google Geocode API credentials not working on the URL

问题

我已经实施了Google地理编码API,它按预期运行。然后由于安全措施,我们决定应用基于Referer的限制。

因此,我已添加*.mydomain.com/*

来自subdomain.com服务器的所有页面都可以正常工作。

我在同一域上运行的另一个服务器上有一个Angular页面。它的访问方式是https://ap1.mydomain.com/page1,但在这个页面1上,出现了“引用未被列入白名单”的错误。

我尝试了以下白名单组合:

*.domain.com
.domain.com/
https://ap1.mydomain.com/page1

什么都没有起作用。任何帮助将不胜感激。

英文:

I have implemented Google Geocoding API and it works as expected. Then due to security measures we decided to apply Referer based restrictions.

For which I have added .mydomain.com/

All the pages coming from server of subdomain.com works fine.

I have a angular page running on other server with same domain. Its accessed as https://ap1.mydomain.com/page1 on this page 1 the error of reffered not whitelisted has received.

I have tried following combination for white listing

*.domain.com
*.domain.com/*
https://ap1.mydomain.com/page1

Nothing works. Any help would be appreciated.

答案1

得分: 1

客户端与服务器端API密钥应用限制

你是否在任何情况下使用服务器端?请注意,客户端服务器端 都适用于Geocoding API。

当你在使用Maps Javascript API中的客户端端Geocoding服务时,你可以设置基于引用的限制,但当你在使用服务器端的Geocoding API时,你需要使用IP地址限制

要了解更多信息,请阅读最佳实践文档:https://developers.google.com/maps/api-security-best-practices#api-key-table-sup-4

希望这有所帮助。

英文:

Client-side vs Server-side API key Application Restrictions

Are you by any means using the server side? Please note that there's a client side and a server side for Geocoding API.

You can set a referer based restriction when you are using the client-side Geocoding service in Maps Javascript API, but when you are using the server-side of Geocoding API, what you have to use is IP address restriction.

To learn more, please read the best practices doc: https://developers.google.com/maps/api-security-best-practices#api-key-table-sup-4

Hope this helps.

huangapple
  • 本文由 发表于 2023年2月18日 02:48:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/75488237.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定