Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS pre-flight in server instance #58

Open
rhexo opened this issue Oct 11, 2020 · 0 comments
Open

CORS pre-flight in server instance #58

rhexo opened this issue Oct 11, 2020 · 0 comments

Comments

@rhexo
Copy link

rhexo commented Oct 11, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant