Is it possible to set a custom function to generat...
# support-questions-legacy
e
Is it possible to set a custom function to generate the cors headers that is called at the time an endpoint is hit? This is what the docs have but we need to be able to set the origin dynamically.
Copy code
const postAuth = middy(middleware()).use(cors({
  origin: // we need to set this dynamically because CI/CD and we don't want to use '*'
  credentials: true,
  headers: ["Content-Type", ...supertokens.getAllCORSHeaders()].join(", "),
  methods: "OPTIONS,POST,GET,PUT,DELETE"
})).onError(request => {
  throw request.error;
});