question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

/openapi should provider CORS headers

See original GitHub issue

Since CORS support is not mandatory in the specification, I’ve seen some implementations that doesn’t use CORS headers on /openapi.

However, tools like Swagger presents the following error message when consuming a MP application with OpenAPI without CORS headers: "Possible cross-origin (CORS) issue? The URL origin (http://localhost:8080) does not match the page (http://localhost). Check the server returns the correct 'Access-Control-Allow-*' headers."

This issue is to request that CORS headers should be mandatory to enable tools like Swagger-UI to consume /openapi endpoint.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Emily-Jiangcommented, Feb 28, 2022

@MikeEdgar I reopened this issue for further discussion. If we all think it is not something we should spec, we can then close it.

1reaction
EricWittmanncommented, Apr 16, 2020

@phillip-kruger confirmed that Quarkus has CORS enabled for the /openapi endpoint but we’ll need to double check on Thorntail and WildFly. We discussed this on the call today and we are not convinced that CORS is something the spec should be mandating. So I think we’re inclined to close this as rejected, unless @MikeEdgar or @arthurdm (or anyone else) have dissenting opinions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable CORS on a resource using the API Gateway import API
... you can set up CORS support using an OpenAPI file. You must first define an OPTIONS method in your resource that returns...
Read more >
CORS - Swagger Documentation
CORS and Header Parameters​​ Swagger UI lets you easily send headers as parameters to requests. The name of these headers MUST be supported...
Read more >
CORS Requirements for "Try It Out" | SwaggerHub ...
API responses must include CORS headers (see below). · API endpoints must support the OPTIONS method for CORS preflight requests. OPTIONS must not...
Read more >
Enabling CORS support for Endpoints - OpenAPI
If a web server supports CORS request, it will handle the OPTIONS request with proper CORS response headers. Handle CORS in your backend...
Read more >
Authoritative guide to CORS (Cross-Origin Resource Sharing ...
An in-depth guide to Cross-Origin Resource Sharing (CORS) for REST APIs, on how CORS works, and common pitfalls especially around security.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found