Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62f952ac68
|
||
|
|
c662626bd8
|
||
|
|
e40afb2c3d
|
@@ -7,7 +7,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "com.jaytux.phoebench"
|
||||
version = PhoebenchVersion(1, 1, 1)
|
||||
version = PhoebenchVersion(1, 1, 2)
|
||||
|
||||
if((version as PhoebenchVersion) < (rootProject.version as PhoebenchVersion))
|
||||
throw GradleException("Server version must be at least as high as protocol/common version")
|
||||
|
||||
@@ -37,20 +37,23 @@ fun Application.module() {
|
||||
json()
|
||||
}
|
||||
|
||||
|
||||
install(SSE) {}
|
||||
|
||||
val allowLocalhost = environment.config.propertyOrNull("ktor.cors.enableLocalhostOn")?.getString() ?: "0"
|
||||
val safeOrigin = environment.config.propertyOrNull("ktor.cors.browserOrigin")?.getString()
|
||||
install(CORS) {
|
||||
// -- methods --
|
||||
allowMethod(HttpMethod.Options)
|
||||
allowMethod(HttpMethod.Delete)
|
||||
allowMethod(HttpMethod.Patch)
|
||||
allowMethod(HttpMethod.Get)
|
||||
allowMethod(HttpMethod.Post)
|
||||
// -- headers --
|
||||
allowHeader(HttpHeaders.Accept)
|
||||
allowHeader(HttpHeaders.Pragma)
|
||||
allowHeader(HttpHeaders.Authorization)
|
||||
allowHeader(HttpHeaders.ContentType)
|
||||
allowHeader(HttpHeaders.CacheControl)
|
||||
allowHeader(HttpHeaders.LastEventID)
|
||||
// -- exposed headers --
|
||||
exposeHeader(HttpHeaders.ContentType)
|
||||
allowCredentials = true
|
||||
allowNonSimpleContentTypes = true
|
||||
@@ -73,6 +76,8 @@ fun Application.module() {
|
||||
}
|
||||
}
|
||||
|
||||
install(SSE) {}
|
||||
|
||||
install(StatusPages) {
|
||||
status(HttpStatusCode.Forbidden) { call, status ->
|
||||
call.respond(status, ErrorResponse("Access Forbidden: CORS failed."))
|
||||
|
||||
Reference in New Issue
Block a user