Bennyh961
Bennyh961

Reputation: 179

Getting Cors for request from my site to my local server

I just learn how to deploy FE side (reqct) into S3.

I allowed public permissions to all files and folder in that bucket and also configure the cors as follow:

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "PUT",
            "POST",
            "DELETE"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 3000
    }
]

It seems like the deployment working well and the files are fetching from the s3. but the connection from the server is blocked by Cors.

=> In the server cors middleware i allowed origin for all '*', it seems it is not the issue, due to nothing happening there when requests are sent from the s3 bucket.

=> I start with HTTP server and HTTPS but got same error: Access to fetch at 'https://localhost:8000/categories/get' from origin 'http://mySite.amazonaws.com' has been blocked by CORS policy: The request client is not a secure context and the resource is in a more private address space local.

=> I tried to also disable and enable the settings from chrome://flags/#allow-insecure-localhost but still nothing happened.

What else can I do? (I prefer not deploy yet the BE and use local server for development)

Upvotes: 0

Views: 95

Answers (0)

Related Questions