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.

Make `CORSConfig` more typesafe

See original GitHub issue

It 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:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
rossabakercommented, Apr 5, 2021

I’m backlog grooming. I started last night in 2014, and am up to 2018! 🚀

1reaction
rossabakercommented, May 15, 2021

Thanks, @qwbarch!

Read more comments on GitHub >

github_iconTop 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 >

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