diff --git a/lib/ret_web/controllers/page_controller.ex b/lib/ret_web/controllers/page_controller.ex index c3fb8b8fd..fd9dc8d6f 100644 --- a/lib/ret_web/controllers/page_controller.ex +++ b/lib/ret_web/controllers/page_controller.ex @@ -692,7 +692,7 @@ defmodule RetWeb.PageController do IO.puts(cors_host, conn.host, compare_hosts(cors_host, conn.host) ) IO.puts(cors_scheme, get_req_header(conn, "x-forwarded-proto") |> Enum.at(0) ) - compare_hosts(cors_host, conn.host) && + compare_hosts(conn.host, cors_host) && cors_scheme == get_req_header(conn, "x-forwarded-proto") |> Enum.at(0) else @@ -744,9 +744,9 @@ defmodule RetWeb.PageController do IO.puts("host1: #{host1}, host2: #{host2}") IO.puts(String.split(host1, ".", parts: -1) |> Enum.slice(0..-2) |> Enum.join(".")) IO.puts(String.split(host2, ".", parts: -1) |> Enum.slice(0..-2) |> Enum.join(".")) - host1 == host2 || (List.last(String.split(host2, ".")) == "dev" && - String.split(host1, ".", parts: -1) |> Enum.slice(0..-2) |> Enum.join(".") == - String.split(host2, ".", parts: -1) |> Enum.slice(0..-2) |> Enum.join(".")) + host1 == host2 || + (host2 |> String.split(".") |> List.last()) == "dev" + && host1 |> String.split(".") |> Enum.slice(0..-2) == host2 |> String.split(".") |> Enum.slice(0..-2) end defp render_static_asset(conn) do