Are preflight OPTIONS requests not handled automat...
# ktor
s
Are preflight OPTIONS requests not handled automatically by a ktor server? both safari and firefox preflights are answered with 403
2
j
Do you have the CORS plugin installed?
s
yep, I'll send it in a bit. trying if it's missing the user agent header now which is also sent during preflights
j
Preflight OPTIONS requests are part of the CORS browser security feature, so Ktor only auto-handles them when that plugin is installed.
Not whitelisting a particular header sounds like a likely cause though! (for anyone reading this later) With the CORS plugin you need to explicitly specify which headers are allowed.
s
yeah sorry, CORS plugin is applied ofc
it was indeed that
allowHeader(HttpHeaders.UserAgent)
was missing. client configuration is shared with other targets so I missed that for the website
j
Amazing, glad you figured it out!
s
luckily I stumbled upon this https://youtrack.jetbrains.com/issue/KTOR-6458/UserAgent-plugin-sends-the-header-even-when-Access-Control-Allow-Headers-doesnt-allow-it don't think I would have found the issue anytime soon otherwise
and what still throws me off is the fact that only safari and firefox respect the custom user agent, chrome still sends it's own