Ktor Server CORS Feature - Pattern matching for origin
Subsystem Server
Is your feature request related to a problem? Please describe. I stumbled upon a problem where I need to allow origin by wildcard or pattern, ex. http://*.example.com so any subdomain is allowed.
Describe the solution you'd like I want to be able to specify a host with a pattern matching like regex or glob style or give us a way to set a custom callback for checking the origin
Motivation to include to ktor There is no way to solve this with the current CORS feature.
Thanks for the feature request! I believe this can be done and we'll try to work on that
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Is there any update on this or at least some method of going about this. I've tried overriding/extending the class but unable as it is set to final.
Is there any information on using the fix in 1.6.5? Do we set subdomains to "", or maybe just put the wildcard in the hosts value ".domain.com"?
please add some examples to use it .I tried with full domain name . still no luck
allowHost("localhost:3000")
allowHost("xyz.xyz.com", schemes = listOf("http", "https"))
@kavithareddyedula It's not documented on web but it has been possible to prefix * for wildcard subdomains. This is documented in allowHost source code.
please add some examples to use it .I tried with full domain name . still no luck allowHost("localhost:3000") allowHost("xyz.xyz.com", schemes = listOf("http", "https"))
allowHost("*.xyz.com", listOf("http", "https"))