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

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.

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

报告相同问题?