mirror of
https://github.com/ash-project/ash_phoenix.git
synced 2024-09-20 07:12:49 +12:00
fix: don't consider www.
as part of the host
This commit is contained in:
parent
7f29471916
commit
b904af654c
1 changed files with 10 additions and 1 deletions
|
@ -100,7 +100,16 @@ defmodule AshPhoenix.SubdomainPlug do
|
|||
if host in [root_host, "localhost", "127.0.0.1", "0.0.0.0"] do
|
||||
nil
|
||||
else
|
||||
String.replace(host, ~r/.?#{root_host}/, "")
|
||||
host
|
||||
|> String.trim_leading("www.")
|
||||
|> String.replace(~r/.?#{root_host}/, "")
|
||||
|> case do
|
||||
"" ->
|
||||
nil
|
||||
|
||||
subdomain ->
|
||||
subdomain
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue