diff --git a/lib/dotcom_web/plugs/canonical_hostname.ex b/lib/dotcom_web/plugs/canonical_hostname.ex index a12a71172a..99a1e4036f 100644 --- a/lib/dotcom_web/plugs/canonical_hostname.ex +++ b/lib/dotcom_web/plugs/canonical_hostname.ex @@ -2,24 +2,14 @@ defmodule DotcomWeb.Plugs.CanonicalHostname do @moduledoc """ Plug to ensure that the site is only accessed via the canonical hostname. In particular, this will prevent users going to www.mbtace.com. - - There is an exception for the hostname that the mTicket app uses, since - we detect that elsewhere in the code to produce some mTicket-specific - effects when the site is loaded in mTicket's webview. """ - @mticket_hostname "mticket.mbtace.com" - import Plug.Conn import Phoenix.Controller, only: [redirect: 2] def init(_) do end - def call(%Plug.Conn{host: @mticket_hostname} = conn, _) do - conn - end - def call(%Plug.Conn{host: requested_hostname} = conn, _) do canonical_hostname = System.get_env("HOST") || "localhost" diff --git a/test/dotcom_web/plugs/canonical_hostname_test.exs b/test/dotcom_web/plugs/canonical_hostname_test.exs index c39362c5c7..2a05ea8113 100644 --- a/test/dotcom_web/plugs/canonical_hostname_test.exs +++ b/test/dotcom_web/plugs/canonical_hostname_test.exs @@ -5,14 +5,6 @@ defmodule DotcomWeb.Plugs.CanonicalHostnameTest do alias DotcomWeb.Plugs.CanonicalHostname describe "call/2" do - test "with the special mTicket hostname, does nothing" do - conn = %Plug.Conn{default_conn() | host: "mticket.mbtace.com"} - assert conn.status != 301 - - conn = CanonicalHostname.call(conn, nil) - assert conn.status != 301 - end - test "with a local IP address, does nothing" do # Class A conn = %Plug.Conn{default_conn() | host: "10.127.127.127"}