Enable CORS in GO application in App engine

0

My API does not respond to requests from third-party sites and for this I need to enable CORS, I tried to add Access-Control-Allow-Origin: "*" to app.yaml but I get the following error.

  

ERROR: (gcloud.app.deploy) An error occurred while parsing file:       [/Users/rafa/go/src/github.com/quickcep/api/app.yaml]       Unexpected attribute "http_headers" for mapping type script.         in "/path/api/app.yaml", line 7, column 37

The content of the app.yaml file is:

runtime: go
api_version: go1.9
handlers:
- url: /.*
    script: _go_app
    http_headers:
        Access-Control-Allow-Origin: "*"
    
asked by anonymous 06.10.2018 / 20:06

1 answer

0

There is a problem with the yaml file id, it should look like this:

runtime: go
api_version: go1.9
handlers:
- url: /.*
  script: _go_app
  http_headers: 
    Access-Control-Allow-Origin: "*"
    
04.12.2018 / 21:33