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.

CorsService's `Access-Control-Allow-Headers` wildcard compatibility

See original GitHub issue

Users may configure Access-Control-Allow-Headers using CorsServiceBuilder#allowRequestHeaders and set allowRequestHeaders as wildcard (*) to allow all headers.

However, it has compatibility issue because Internet Explorer, Safari and Firefox for Android don’t support: image

So I guess that CorsService doesn’t support allowing all headers. And it would be fixed by returning requested Access-Control-Request-Headers header and providing an option:

allowAllRequestHeaders() {
  allowAllRequestHeaders(false);
}

allowAllRequestHeaders(boolean useWildcard) {
  ...
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
minwooxcommented, Sep 29, 2021

@minwoox wanted to override additional restrictions

That’s not what I wanted. I just didn’t know about those headers could be ommited.

Even application/json is not allowed if Content-Type is not specified in the allowed header.

That’s true. In this case, the browser will set the Content-Type to Access-Control-Request-Headers and the response should contain Content-Type in Access-Control-Allow-Headers which means Content-Type needs to be set via CorsServiceBuilder#allowRequestHeaders.

0reactions
ks-yimcommented, Sep 29, 2021

I thought @minwoox wanted to override additional restrictions 😄. Even application/json is not allowed if Content-Type is not specified in the allowed header.

Either way is fine for me, though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Access-Control-Allow-Headers" | Can I use... Support tables ...
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
Enabling Cross-Origin Requests (CORS) - ASP.NET
When using MVC to enable CORS the same CORS services are used, but the CORS middleware ... or is the wildcard value “*”,...
Read more >
CORS Access-Control-Allow-Headers wildcard being ignored?
Support for wildcards in the Access-Control-Allow-Headers header was added to the living standard only in May 2016, so it may not be ...
Read more >
Cross-origin resource sharing - Wikipedia
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a ... a wildcard indicating that the requests from all domains...
Read more >
fruitcake/php-cors - Packagist
... and is compatible with the options for CorsService. ... allowedHeaders, Sets the Access-Control-Allow-Headers response header.
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