0

I have a static website hosted on AWS S3 bucket. My website has Google place API integartion, but I am getting CORS error while my website is trying to make request to "https://maps.googleapis.com/maps/api/place/autocomplete" API.

I have configured following CORS on S3 bucket -

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": []
    }
]

Is there anythng else I am missing? I also have updated CORS settings on Google API Console -

enter image description here

Note :- It works if I enable CORS extension in browser

Sachin Vairagi
  • 4,894
  • 4
  • 35
  • 61
  • 1
    CORS is to be configured on the server side (in your case: Google Maps' API), not on the client side (in your case: S3). You'll need to configure Google Maps' API for CORS if you can. – jub0bs Jul 17 '23 at 08:49
  • Does this answer your question? [No 'Access-Control-Allow-Origin' header is present on the requested resource—when trying to get data from a REST API](https://stackoverflow.com/questions/43871637/no-access-control-allow-origin-header-is-present-on-the-requested-resource-whe) – jub0bs Jul 17 '23 at 08:49
  • @jub0bs - Thanks much for your prompt response, I have enabled CORS from google API console and hence able to make request from my localhost. But the same code is not workig on S3 bucket. – Sachin Vairagi Jul 17 '23 at 08:51
  • 3
    _I have enabled CORS from google API console_. Edit your question and explain how. – jub0bs Jul 17 '23 at 08:55

0 Answers0