Skip to content

Setting the origin of the request #69

@zastrixarundell

Description

@zastrixarundell

Not really an issue but would be an awesome upgrade. I've tested the websocket client on my server in production and I get the following (you can skip after the block of code, I'll provide a TL;DR):

2020-02-28T21:37:23.790390+00:00 app[web.1]: 21:37:23.790 [error] Could not check origin for Phoenix.Socket transport.

2020-02-28T21:37:23.790398+00:00 app[web.1]: 

2020-02-28T21:37:23.790398+00:00 app[web.1]: Origin of the request: https://github.com/gilmaimon/TinyWebsockets

2020-02-28T21:37:23.790399+00:00 app[web.1]: 

2020-02-28T21:37:23.790399+00:00 app[web.1]: This happens when you are attempting a socket connection to

2020-02-28T21:37:23.790400+00:00 app[web.1]: a different host than the one configured in your config/

2020-02-28T21:37:23.790400+00:00 app[web.1]: files. For example, in development the host is configured

2020-02-28T21:37:23.790400+00:00 app[web.1]: to "localhost" but you may be trying to access it from

2020-02-28T21:37:23.790401+00:00 app[web.1]: "127.0.0.1". To fix this issue, you may either:

2020-02-28T21:37:23.790401+00:00 app[web.1]: 

2020-02-28T21:37:23.790401+00:00 app[web.1]:   1. update [url: [host: ...]] to your actual host in the

2020-02-28T21:37:23.790402+00:00 app[web.1]:      config file for your current environment (recommended)

2020-02-28T21:37:23.790402+00:00 app[web.1]: 

2020-02-28T21:37:23.790403+00:00 app[web.1]:   2. pass the :check_origin option when configuring your

2020-02-28T21:37:23.790403+00:00 app[web.1]:      endpoint or when configuring the transport in your

2020-02-28T21:37:23.790404+00:00 app[web.1]:      UserSocket module, explicitly outlining which origins

2020-02-28T21:37:23.790404+00:00 app[web.1]:      are allowed:

2020-02-28T21:37:23.790405+00:00 app[web.1]: 

2020-02-28T21:37:23.790405+00:00 app[web.1]:         check_origin: ["https://example.com",

2020-02-28T21:37:23.790405+00:00 app[web.1]:                        "//another.com:888", "//other.com"]

Basically the issue is that the origin is https://github.com/gilmaimon/TinyWebsockets and I need to add it to the accepted origins in my app. It would be awesome to make it configurable.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions