Skip to content

Commit dfa828e

Browse files
authored
Fix CORS problem on WebConnector (Options method not allowed) (#1945)
1 parent 407341f commit dfa828e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bot/connector-web/src/main/kotlin/WebConnector.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,11 @@ class WebConnector internal constructor(
148148
// browsers do not send or save cookies unless credentials are allowed
149149
.allowCredentials(webSecurityHandler is WebSecurityCookiesHandler)
150150

151+
// Apply CORS Handler for all paths and all methods (OPTIONS handled automatically)
152+
router.route("$path*").handler(corsHandler)
153+
151154
if (sseEnabled) {
152155
router.route("$path/sse")
153-
.handler(corsHandler)
154156
.handler(webSecurityHandler)
155157
.handler { context ->
156158
try {
@@ -189,7 +191,6 @@ class WebConnector internal constructor(
189191

190192
// Main connector endpoint
191193
router.post(path)
192-
.handler(corsHandler)
193194
.handler(webSecurityHandler)
194195
.handler { context ->
195196
// Override the user on the request body

0 commit comments

Comments
 (0)