Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 97d8dae

Browse files
committed
refactor(endpoint): try redirect www -> non-www
1 parent 780468b commit 97d8dae

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

lib/mastani_server_web/endpoint.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
defmodule MastaniServerWeb.Endpoint do
22
use Phoenix.Endpoint, otp_app: :mastani_server
33

4+
if Mix.env() == :prod do
5+
plug(PlugCanonicalHost, canonical_host: "coderplanets.com")
6+
end
7+
48
socket("/socket", MastaniServerWeb.UserSocket)
59

610
plug(Plug.RequestId)

mix.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ defmodule MastaniServer.Mixfile do
9393
{:excoveralls, "~> 0.8", only: :test},
9494
{:sentry, "~> 6.4"},
9595
{:recase, "~> 0.3.0"},
96-
{:nanoid, "~> 2.0.0"}
96+
{:nanoid, "~> 2.0.0"},
97+
# redirect www -> non-www
98+
{:plug_canonical_host, "~> 0.3.1"}
9799
]
98100
end
99101

mix.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"phoenix_ecto": {:hex, :phoenix_ecto, "4.0.0", "c43117a136e7399ea04ecaac73f8f23ee0ffe3e07acfcb8062fe5f4c9f0f6531", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
4545
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.1", "6668d787e602981f24f17a5fbb69cc98f8ab085114ebfac6cc36e10a90c8e93c", [:mix], [], "hexpm"},
4646
"plug": {:hex, :plug, "1.7.1", "8516d565fb84a6a8b2ca722e74e2cd25ca0fc9d64f364ec9dbec09d33eb78ccd", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}], "hexpm"},
47+
"plug_canonical_host": {:hex, :plug_canonical_host, "0.3.1", "0c279b7631ccb6ddb53bf58bdfa015ca69109f52a1fd4cc30909f92313d969e0", [:mix], [{:plug, " ~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
4748
"plug_cowboy": {:hex, :plug_cowboy, "2.0.0", "ab0c92728f2ba43c544cce85f0f220d8d30fc0c90eaa1e6203683ab039655062", [:mix], [{:cowboy, "~> 2.5", [hex: :cowboy, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
4849
"plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm"},
4950
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},

0 commit comments

Comments
 (0)