2017-12-01 4 views
0

Play Framework에 잘못된 CORS 문제가 있습니다.전자 응용 프로그램과 함께 2.6 재생 - CORS

[warn] p.f.c.CORSFilter - Invalid CORS request;Origin=Some(file://);Method=POST;Access-Control-Request-Headers=None

는 어떻게하면 전자 응용 프로그램과 함께 작동하도록 구성 할 수 있습니다?

이 내 application.conf 현재 : 여전히

play.application.loader = "modules.ApplicationLoaderConfig" 
play.modules.enabled += "play.modules.reactivemongo.ReactiveMongoModule" 

그러나 그것을가 동작하지 않습니다 : 나는 또한 단지 떠나 .. 필터를 제거하려

play.application.loader = "modules.ApplicationLoaderConfig" 
play.modules.enabled += "play.modules.reactivemongo.ReactiveMongoModule" 
play.filters.enabled += "play.filters.cors.CORSFilter" 
play.filters.cors { 
    allowedOrigins = null,  # This means "all" 
    allowedHttpMethods = null, # This means "all" 
    exposedHeaders = ["Authorization", "Content-Length", "Content-Type", "Content-disposition"], 
    preflightMaxAge = 7 days 
} 

.

app.on('ready',() => { 
    win = new BrowserWindow({ 
    webPreferences: { webSecurity: false } 
    }); 

제가 true false과 동시에했지만, 차이하지 : 전자 측에서

는 I webSecurity 또한 옵션으로 보았습니다.

미리 감사드립니다.

답변

1

이 구성을 설정하십시오

play.filters.cors.serveForbiddenOrigins = true 
사실

, 그들이 뭔가를 요청할 때 기원이 허용되지 않습니다 "파일"로 및 기본 재생으로 설정되어 있기 때문에, 전자 Apps에서 재생을 사용하여 몇 가지 문제가있다 .

참조를 위해이 링크를 참조하십시오. 이 도움이

  1. https://github.com/Hub-of-all-Things/HAT2.0/pull/39
  2. https://github.com/playframework/playframework/issues/8037
  3. https://github.com/playframework/playframework/pull/7341

희망!

관련 문제