Glimesh / glimesh.tv

Glimesh is a next generation live streaming platform built by the community, for the community.
https://glimesh.tv
Other
470 stars 79 forks source link

Redirect to primary domain name #55

Closed clone1018 closed 4 years ago

clone1018 commented 4 years ago

We're getting a lot of people hit www. our domain, which causes Phoenix to freak out a bit.

app_1  | 21:50:50.251 [error] Could not check origin for Phoenix.Socket transport.
app_1  |
app_1  | Origin of the request: https://www.glimesh.tv
app_1  |
app_1  | This happens when you are attempting a socket connection to
app_1  | a different host than the one configured in your config/
app_1  | files. For example, in development the host is configured
app_1  | to "localhost" but you may be trying to access it from
app_1  | "127.0.0.1". To fix this issue, you may either:
app_1  |
app_1  |   1. update [url: [host: ...]] to your actual host in the
app_1  |      config file for your current environment (recommended)
app_1  |
app_1  |   2. pass the :check_origin option when configuring your
app_1  |      endpoint or when configuring the transport in your
app_1  |      UserSocket module, explicitly outlining which origins
app_1  |      are allowed:
app_1  |
app_1  |         check_origin: ["https://example.com",
app_1  |                        "//another.com:888", "//other.com"]
app_1  |
app_1  |

Seems like https://hexdocs.pm/plug_canonical_host/readme.html might fix it?

enixlabs commented 4 years ago

That's an easy one to fix, as it looks like a similar issue to Nginx and it's to do with your host file. If you've not done it and I'm not 100% sure with your structure, you need to add in various routing options for all domains and IP's required

For example - 12.0.0.1(IP First) Localhost(Hostname Second) local.localhost(full host domain).

Now I don't know how you're routing works in terms of the hosting, as running applications such as Odoo (Awesome Open Source) you need to configure for full IP proxy, as well as routing within the server config for those IPs.

If you've done this, my apologies and if not, I hope it helps....

enixlabs commented 4 years ago

And yes just reading over the attached link, that is exactly it..