csisnett
Plug.SSL redirects socket connection problem 301
Hi everyone!
I’m trying to connect with websockets but is not working when I deploy it I get this message in the server:
Plug.SSL is redirecting GET /socket/websocket to https://pelable.com with status 301
On localhost the connection and the chat channel work correctly so I’m guessing I need to change something in the configuration but not sure what in order to make it work
This is my prod.exs file:
use Mix.Config
config :pelable, PelableWeb.Endpoint,
http: [:inet6, port: System.get_env("PORT") || 4000],
url: [scheme: "https", host: System.get_env("RENDER_EXTERNAL_HOSTNAME") || "localhost", port: 443],
force_ssl: [rewrite_on: [:x_forwarded_proto]],
cache_static_manifest: "priv/static/cache_manifest.json"
config :logger, level: :info
And I’m using releases.exs:
import Config
config :pelable, PelableWeb.Endpoint,
http: [:inet6, port: System.get_env("PORT") || 4000],
url: [scheme: "https", host: "pelable.com", port: 443],
force_ssl: [rewrite_on: [:x_forwarded_proto]],
cache_static_manifest: "priv/static/cache_manifest.json",
config :logger, level: :info
config :pelable, PelableWeb.Endpoint, server: true
config :pelable, PelableWeb.Endpoint,
secret_key_base: System.get_env("SECRET_KEY_BASE")
config :pelable, Pelable.Repo,
ssl: true,
database: System.get_env("DATABASE_URL"),
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
Most Liked
csisnett
deleted the line:
force_ssl: [rewrite_on: [:x_forwarded_proto]]
from prod.exs and is now working
:
updated prod.exs:
use Mix.Config
config :pelable, PelableWeb.Endpoint,
http: [:inet6, port: System.get_env("PORT") || 4000],
url: [host: System.get_env("RENDER_EXTERNAL_HOSTNAME") || "localhost", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
config :logger, level: :info
updated releases.exs:
import Config
config :logger, level: :info
config :pelable, PelableWeb.Endpoint, server: true
config :pelable, PelableWeb.Endpoint,
secret_key_base: System.get_env("SECRET_KEY_BASE")
config :pelable, Pelable.Repo,
ssl: true,
database: System.get_env("DATABASE_URL"),
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
1
Popular in Questions
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Other popular topics
Hello, how can I check the Phoenix version ?
Thanks !
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









