Closed jpcapone closed 1 year ago
I know what this is @jpcapone - There's another environment variable that you can sometimes set called PHX_HOST
so the websocket can connect.
This is so that when you deploy any Phoenix app to prod, you can only connect to your backend from mydomain.com.
In this case you're just hitting localhost:4000 right? I just pushed a change that may fix this - could you pull it down and give it a try? Thanks for helping me figure this out.
You just need to pull and re-run, no need to set the PHX_HOST
variable.
Thanks for getting back to me. I killed the container and deleted the image and forced a redownload and the issue remains. I am sure you already know what the log looks like but below i have added a snipped
`03:34:49.210 [error] Could not check origin for Phoenix.Socket transport.
Origin of the request: http://255.255.255.252:4000
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"]`
How do I allow connections to any address? I tried - PHX_HOST=0.0.0.0
, but that didn't work.
Asking for some help in the ElixirForums here - https://elixirforum.com/t/could-not-check-origin-for-phoenix-socket-transport-in-prod-running-on-docker/55269
I don't know how to fix this
@askiiart try - PHX_HOST=magnetissimo.domain.tld, replace magnetissimo.domain.tld with your domain
@askiiart try - PHX_HOST=magnetissimo.domain.tld, replace magnetissimo.domain.tld with your domain
would this work for my issue as well? I assume i should have a dns record that resolves the domain name?
@jpcapone you can give it a try, also if you are using Nginx Proxy Manager be sure to enable Websockets support
magnetissimo
I am not using any proxying within my home network
added this line to the docker compose file
PHX_HOST=magnetissimo.blahblah.bla
still getting
I created and confirmed resolution to the PHX_HOST entry. Any other suggestions.
@jpcapone
Use PHX_HOST=<IP_ADDRESS_HERE>
, for example PHX_HOST=192.168.1.23
That did it for me. I am in!
Fantastic!
@jpcapone
Use
PHX_HOST=<IP_ADDRESS_HERE>
, for examplePHX_HOST=192.168.1.23
I have done this but am still experiencing the issue
@Ethergy Could you please provide logs?
@Ethergy Could you please provide logs? _magnetissimo_logs.txt Looks like it's whatever is going on in #161 actually
Fresh docker deployment and I am able to connect to the app but I get this error![image](https://user-images.githubusercontent.com/47680328/231931263-e6fac6c7-4f5f-4ca9-9ea2-5988c64ddd5e.png)
any suggestions?