fix websocket handling on production
This commit is contained in:
parent
62ab267d00
commit
ce1276a19f
|
@ -1,11 +1,10 @@
|
|||
package lila.app
|
||||
|
||||
// import lila.app.Env
|
||||
import lila.hub.actorApi.monitor.AddRequest
|
||||
|
||||
import play.api.{ Application, GlobalSettings, Mode }
|
||||
import play.api.mvc._
|
||||
import play.api.mvc.Results._
|
||||
import play.api.{ Application, GlobalSettings, Mode }
|
||||
|
||||
import lila.hub.actorApi.monitor.AddRequest
|
||||
|
||||
object Global extends GlobalSettings {
|
||||
|
||||
|
@ -19,7 +18,7 @@ object Global extends GlobalSettings {
|
|||
else Action(NotFound("I am an AI server")).some
|
||||
}
|
||||
else {
|
||||
if (!Env.api.isProd) println(req)
|
||||
// if (!Env.api.isProd) println(req)
|
||||
Env.monitor.reporting ! AddRequest
|
||||
Env.security.wiretap(req)
|
||||
Env.security.firewall.requestHandler(req).await orElse
|
||||
|
@ -42,4 +41,5 @@ object Global extends GlobalSettings {
|
|||
super.onError(request, ex)
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import play.api.mvc.{ Action, RequestHeader, Handler }
|
|||
final class I18nRequestHandler(pool: I18nPool, protocol: String) {
|
||||
|
||||
def apply(req: RequestHeader): Option[Handler] =
|
||||
if (req.host contains ":9000") None
|
||||
if (req.host startsWith "socket.") None
|
||||
else pool.domainLang(req).isDefined.fold(
|
||||
None,
|
||||
Action {
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
}
|
||||
|
||||
var sri = Math.random().toString(36).substring(5);
|
||||
var wsUrl = "ws://" + document.domain + ":9000/monitor/socket?sri=" + sri;
|
||||
var wsUrl = "ws://socket." + document.domain + "/monitor/socket?sri=" + sri;
|
||||
var ws = window.MozWebSocket ? new MozWebSocket(wsUrl) : new WebSocket(wsUrl);
|
||||
ws.onmessage = function(e) {
|
||||
var m = JSON.parse(e.data);
|
||||
|
|
Loading…
Reference in a new issue