secure icon indicating copy to clipboard operation
secure copied to clipboard

Support for Access-Control-Allow-Origin headers?

Open bramp opened this issue 5 years ago • 3 comments

Worth adding support for Access-Control-Allow-Origin headers? Perhaps even reusing the AllowedHost list?

bramp avatar Jul 20 '20 00:07 bramp

There are a bunch of Access-Control-* headers we could add... what is we did the same concept as #73 and create a helper to generate the output... something like:

secure.Options{
  AccessControl: secure.AccessControlOptions{
    AllowCredentials: true,
    AllowHeaders: ["DNT", "User-Agent", "Cache-Control", "Content-Type"],
    AllowMethods: ["GET", "POST", "OPTIONS"],
    AllowOrigin: "*",
    ExposeHeaders: ["Cache-Control", "Content-Language", "Content-Length", "Content-Type"]
    MaxAge: 1728000,
    RequestHeaders: ["X-PINGOTHER", "Content-Type"],
    RequestMethod: ["POST"],
  }
}

unrolled avatar Jul 21 '20 16:07 unrolled

@unrolled Is there a branch with these CORS options in or have you abandoned the idea of adding it to the lib? I can't seem to find the options in the repo atm. 🙏🏻

emarais-godaddy avatar Jun 15 '21 14:06 emarais-godaddy

Hey @emarais-godaddy, this hasn't been implemented yet. I still like the idea but haven't had the time to work on it. Would love some help if you (or anyone else) has time!

unrolled avatar Jun 16 '21 15:06 unrolled