Skip to content

CORS pre-flight in server instance #58

Description

@rhexo

Hi.

I'm trying to use this odata-v4-server as a service with sap open ui5 framework in couple. Using @odata.cors don't satisfy requirements of open ui5 because they actively using "options" request for pre-flight check. In this case i enhance static create method of class ODataServerBase to support pre-flight conditions in this way

....
if (server.cors) {
var corsOpt = {
origin: ['http://localhost:8080', 'http://localhost'],
optionsSuccessStatus: 204,
exposedHeaders: ['OData-Version']
}
router.options('*', cors(corsOpt))
router.use(cors(corsOpt));
}

May be exists another way, supported by this odata-v4-server api? Using a router class as optional parameter of create method can be is alternative solution.

P.S. using router instance, that returned by create method(without port parameter request) has no effect. If reffer to documentation of npm cors package, using pre-flight conditions have to declare before any router definition in express instance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions