Skip to content

Instantly share code, notes, and snippets.

@paulanthonywilson
Created February 23, 2021 15:35
Show Gist options
  • Save paulanthonywilson/586a0e5a278238207e527f697cddcaf7 to your computer and use it in GitHub Desktop.
Save paulanthonywilson/586a0e5a278238207e527f697cddcaf7 to your computer and use it in GitHub Desktop.
defmodule MasterProxy.Proxy do
@moduledoc """
Simple plug to act as a proxy (for Heroku). It inspects the path and calls the appropriate endpoint.
"""
def init(options), do: options
def call(conn, _) do
if String.starts_with?(conn.request_path, "/admin") do
Admin.Endpoint.call(conn, [])
else
EmployeeUi.Endpoint.call(conn, [])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment