Make `CORSConfig` more typesafe
See original GitHub issueIt would be nice to have a CORSConfig
more typesafe. This is the definition at the moment (Source):
final case class CORSConfig(
anyOrigin: Boolean,
allowCredentials: Boolean,
maxAge: Long,
anyMethod: Boolean = true,
allowedOrigins: String => Boolean = _ => false,
allowedMethods: Option[Set[String]] = None,
allowedHeaders: Option[Set[String]] = Set("Content-Type", "*").some,
exposedHeaders: Option[Set[String]] = Set("*").some
)
I propose to have at least maxAge
as a FiniteDuration
and allowedMethods
as Option[Set[org.http4s.Method]]
. Probably allowedHeaders
and exposedHeaders
could make use of the org.http4s.Header
type as well. org.http4s.Headers
exists but its internal representation is a List
.
Don’t mind submitting a PR with these changes.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
[Bug] CORS header missing on 500 (Internal Server Error ...
Perhaps having a flag in the CORSConfig to either catch or passthrough errors (with the default ... Make CORSConfig more typesafe #1717.
Read more >Spring Webflux and CORS - Baeldung
A quick and practical guide to working with CORS and Spring Webflux.
Read more >Configure cross-origin resource sharing (CORS) | Cloud Storage
Go to concepts. Cross Origin Resource Sharing (CORS) allows interactions between resources from different origins, something that is normally prohibited in ...
Read more >[Solved]-setting up CORS config with multiple hosts-C#
Coding example for the question setting up CORS config with multiple hosts-C#. ... You can add multiple origins by separating them with commas:...
Read more >How Kong helped us solve our long-lasting CORS issue
So the first thing we did, and my first tip for you, is to create a dedicated exploratory testing environment. Our environment included:....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m backlog grooming. I started last night in 2014, and am up to 2018! 🚀
Thanks, @qwbarch!