調整CORS設定
This commit is contained in:
@@ -8,13 +8,20 @@ import io.ktor.server.routing.*
|
|||||||
|
|
||||||
fun Application.configureHttp() {
|
fun Application.configureHttp() {
|
||||||
install(CORS) {
|
install(CORS) {
|
||||||
|
allowHost("localhost:8080")
|
||||||
|
allowHost("table.sakunadaisuki.club")
|
||||||
|
|
||||||
allowMethod(HttpMethod.Options)
|
allowMethod(HttpMethod.Options)
|
||||||
allowMethod(HttpMethod.Put)
|
allowMethod(HttpMethod.Put)
|
||||||
allowMethod(HttpMethod.Delete)
|
allowMethod(HttpMethod.Delete)
|
||||||
allowMethod(HttpMethod.Patch)
|
allowMethod(HttpMethod.Patch)
|
||||||
allowHeader(HttpHeaders.Authorization)
|
allowHeader(HttpHeaders.Authorization)
|
||||||
|
|
||||||
|
allowHeader(HttpHeaders.ContentType) // 處理 JSON 必備
|
||||||
|
allowHeader(HttpHeaders.Authorization) // 傳遞 JWT / 身份驗證權限必備
|
||||||
|
|
||||||
allowHeader("MyCustomHeader")
|
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 {
|
routing {
|
||||||
swaggerUI(path = "openapi") {
|
swaggerUI(path = "openapi") {
|
||||||
|
|||||||
Reference in New Issue
Block a user