dtsfnyay300457 2013-08-24 19:36
浏览 40
已采纳

too long

I'm getting this error message in my production box:

The Google Maps API server rejected your request. The "sensor" parameter specified in the request must be set to either "true" or "false".

When the browser hits:

<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=mykey&sensor=true">

I see that the browser calls upon:

http:// maps . google . com /maps?file=api&v=2&key=mykey&sensor=true

And then it shows me the error message.

I copy the url it's hitting and paste it in the browser and it downloads the correct js, not the one with the alert message.

I created a sample page and tested it in my local dev box and my test server; it renders fantastic. Test box: http://www.probit.co/Prototypes/GPS/MapTest.html

I placed the very same file in production box and it throws me the message. Production box: http://www.hondutrack.com/rastreo/MapTest.html

Why wouldn't it work in Production?

  • 写回答

1条回答 默认 最新

  • doujiyan0031 2013-08-28 03:58
    关注

    To answer my own question:

    Even though the message showed some problem with the sensor parameter, I concluded that it was a domain issue, some kind of ban from the google map service.

    Like it's detailed above, the very same html which renders the map was placed in three different domains, all of them working as expected but the production one. I used fiddler to see the request sent by

    <script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=mykey&sensor=true">
    

    The original hit, returned the js with the error alert. I did a replay and changed the referer property in the http header with an invented and not existent domain (www.hondutrack1.com) and it worked liked a charm.

    So to restore the service, we bought that domain, setup mod_rewrite in the apache server, created the rewrite in the root .htaccess file and everything is working now.

    I know this is a workaround, kind of dirty, but at least the service is up and running.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?