Bug in the "allowMethods" of the CORS preflight settings of HttpApi

0

These are my settings in the AWS CDK:

    const api = new HttpApi(this, "bundled-api", {
      corsPreflight: {
        allowCredentials: true,
        allowHeaders: [
          "authorization",
          "mama-trace-id",
          "content-type",
          "test-header",
        ],
        allowMethods: [
          CorsHttpMethod.GET,
          CorsHttpMethod.POST,
          CorsHttpMethod.PUT,
          CorsHttpMethod.PATCH,
          CorsHttpMethod.OPTIONS,
          CorsHttpMethod.HEAD,
        ],
        allowOrigins: domainList,
      },
      disableExecuteApiEndpoint: true,
      defaultDomainMapping: {
        domainName: this.domainName,
      },
      defaultAuthorizer: lambdaAuthorizer,
    });

The console shows this: Enter image description here

But this is my preflight response: Enter image description here

As one can see, the Access-Control-Allow-Methods is set to *, even tough the console says so differently. Is this a bug or am I doing something wrong? I have disabled cache in my browser and I have recently added "test-header" to the allowed headers and it shows up. So this cannot be a caching issue.

Additional Information: I am using a HttpAlbIntegration with:

    const mapToRoot = new ParameterMapping().overwritePath({
      value: "/$request.path.proxy",
    });
Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen