調整CORS設定

This commit is contained in:
2026-08-08 19:55:48 +08:00
parent e936250391
commit 5dfaa68e0e
@@ -8,13 +8,20 @@ import io.ktor.server.routing.*
fun Application.configureHttp() {
install(CORS) {
allowHost("localhost:8080")
allowHost("table.sakunadaisuki.club")
allowMethod(HttpMethod.Options)
allowMethod(HttpMethod.Put)
allowMethod(HttpMethod.Delete)
allowMethod(HttpMethod.Patch)
allowHeader(HttpHeaders.Authorization)
allowHeader(HttpHeaders.ContentType) // 處理 JSON 必備
allowHeader(HttpHeaders.Authorization) // 傳遞 JWT / 身份驗證權限必備
allowHeader("MyCustomHeader")
anyHost() // @TODO: Don't do this in production if possible. Try to limit it.
//anyHost() // @TODO: Don't do this in production if possible. Try to limit it.
}
routing {
swaggerUI(path = "openapi") {