I'm trying to tackle an issue with my cors config ...
# help
l
I'm trying to tackle an issue with my cors config for apigw2 for the better part of the day and seeing no progress.. Whenever I call a single endpoint with different query params preflight kicks in like it's a new route. Anyone seen similar results?
a
could you share your Api construct definition?
l
Copy code
this.api = new sst.Api(this, "GlobalApi", {
            defaultAuthorizationType: sst.ApiAuthorizationType.JWT,
            defaultAuthorizer: cognitoGatewayAuth,
            defaultAuthorizationScopes: [],
            cors: {
                allowOrigins: ['https://*'],
                allowHeaders: ['authorization', 'roleid', 'companyid', 'accept-encoding', 'accept-language', 'content-type', 'referer', 'user-agent'],
                maxAge: Duration.seconds(86400),
                allowMethods: [<http://CorsHttpMethod.POST|CorsHttpMethod.POST>, CorsHttpMethod.PUT, CorsHttpMethod.GET, CorsHttpMethod.DELETE],
                allowCredentials: false,
            }
        });
This one works for regular use cases, requests with body etc will only prefetch a single time, but any params after
?
will invoke a new prefetch for the same endpoint..