2017-04-03 1 views
3

は私がhttps://team_abc.dev.myapp.me/エラーを修正するにはどうすればいいですか?Phoenix.Socketトランスポートの原点を確認できませんでしたか? (フェニックス1.2.1)

This issue might be specific for subdomains. Not very sure in what other contexts this issue arrises. 

    07:26:06.498 [error] Could not check origin for Phoenix.Socket transport. 

This happens when you are attempting a socket connection to 
a different host than the one configured in your config/ 
files. For example, in development the host is configured 
to "localhost" but you may be trying to access it from 
"127.0.0.1". To fix this issue, you may either: 

    1. update [url: [host: ...]] to your actual host in the 
    config file for your current environment (recommended) 

    2. pass the :check_origin option when configuring your 
    endpoint or when configuring the transport in your 
    UserSocket module, explicitly outlining which origins 
    are allowed: 

     check_origin: ["https://example.com", 
         "//another.com:888", "//other.com"] 

07:26:20.174 [error] Could not check origin for Phoenix.Socket transport. 

This happens when you are attempting a socket connection to 
a different host than the one configured in your config/ 
files. For example, in development the host is configured 
to "localhost" but you may be trying to access it from 
"127.0.0.1". To fix this issue, you may either: 

にアクセスするたびに、私は私のendpoint.exに

plug Plug.Session, 
store: :cookie, 
key: "_myapp_key", 
signing_salt: "RHWasYaA", 
domain: ".dev.myapp.me" 

と私のprod.exs

http: [port: {:system, "PORT"}], 
url: [host: "dev.myapp.me", port: 80] 
に次のように次き、次のエラーを取得します

私もprod.exsで追加しました

config :myapp, MyApp.Endpoint, 
check_origin: ["https://dev.myapp.me", "https://myapp.me"] 

この問題を解決する方法はありますか?ありがとう。 check_origin: [..., "//team_abc.dev.myapp.me"]

EDIT:

答えて

7

あなたはcheck_originであなたのホストに解決するすべてのドメインを追加する必要がありcheck_origin機能のソースコードを読んだ後 を、ワイルドカードドメイン名を設定することが可能なはずであるように思えます check_origin: [..., "//*.myapp.me"]

詳細:このようなhttps://github.com/phoenixframework/phoenix/blob/da9f7653b9daf29a4c415be52a19ee6f4473e083/lib/phoenix/socket/transport.ex#L444

+0

私は設定ですべてのそれらのドメインを追加することはできません。すべてのサブドメインが動的に作成されます(例:Slackでチームを作成する場合など) – Anil

+0

ワイルドカードドメインの設定例が追加されました。 – Lachezar

関連する問題