Uploaded image for project: 'Okapi'
  1. Okapi
  2. OKAPI-876

CORS delegation doesn't work with preflight/OPTIONS requests

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: P2
    • Resolution: Done
    • Affects Version/s: 3.1.2
    • Fix Version/s: 4.7.3, 4.8.0
    • Labels:
    • Template:
      Standard Bug Write-Up Format
    • Sprint:
      CP: sprint 92, CP: sprint 110, CP: sprint 111, CP: sprint 112
    • Story Points:
      5
    • Development Team:
      Core: Platform
    • Release:
      R2 2021

      Description

      Overview:
      The way that CORS delegation was implemented, the CorsHandler is sometimes called multiple times. For most requests this is fine (albeit inefficient). However, the vertx CorsHandlerImpl sends a response if handling an OPTIONS request instead of calling routingContext.next(). The result is that the first time the default handler is called, the request only has CHECK_DELEGATE_CORS set, and since the check has not yet happened, CORS is handled by OKAPI and the response is set, even in cases when delegateCORS=true.

      Steps to Reproduce:

      1. Set a handler so that delegateCORS=true
      2. Register/Enable the module descriptor
      3. make a preflight request to that endpoint via the /_/invoke/tenant/<tid>/path API
      4. Observe via X-Okapi-Trace that the request was never proxied to the module, but rather CORS was handled by OKAPI.

      Expected Results:
      The OPTIONS request is proxied to the module

      Actual Results:
      OKAPI handles CORS

      Additional Information:
      Interested parties:
      Hongwei Ji

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                hji Hongwei Ji
                Reporter:
                cmcnally Craig McNally
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases