You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My app is an umbrella with an api app that forwards to a versioned endpoint, like:
forward("/v1", to: V1)
inside of the V1 router, I have a forward to my auth handler:
forward("/auth", to: V1.Routes.Auth)
and my auth handler looks like:
defmodule V1.Routes.Auth do
use Plug.Router
require Logger
plug(:match)
plug(:fetch_query_params)
plug(Ueberauth)
plug(:dispatch)
get "/:provider/callback" do
conn
|> send_resp(200, %{success: "facebook"})
end
match _ do
conn
|> send_resp(404, %{error: "Not found"})
end
end
I have facebook configured and when ever I go to the url: /v1/auth/facebook I get a 404. Now if I move that /auth forward in to main api router, then /auth/facebook will work, but if I add V1 in front of that url, within the forward at all, I get a 404. I have tried setting the base path in the config, and explicitly setting the paths for the facebook strategy config.
Im not using Phoenix for this, it's pure plug.
The text was updated successfully, but these errors were encountered:
defmodule Api do
require Logger
use Responses
use Plug.Router
plug(Plug.Logger)
plug(
Plug.Static,
at: "/public",
from: "public"
)
plug(:match)
plug(:dispatch)
forward("/v1", to: V1)
get "/" do
conn
|> send_file(:ok, "public/index.html")
end
match _ do
conn
|> json(404, %{error: "not found"})
end
end
V1 ROUTER
defmodule V1 do
use Router
plug(Plug.Logger)
plug(:match)
plug(:dispatch)
forward("/user", to: V1.Routes.User)
forward("/auth", to: V1.Routes.Auth)
match _ do
conn
|> json(404, %{error: "Not found"})
end
end
AUTH ROUTER:
defmodule V1.Routes.Auth do
use Plug.Router
require Logger
plug(:match)
plug(:fetch_query_params)
plug(Ueberauth)
plug(:dispatch)
get "/:provider/callback" do
conn
|> send_resp(200, %{success: "facebook"})
end
match _ do
conn
|> send_resp(404, %{error: "Not found"})
end
end
My app is an umbrella with an api app that forwards to a versioned endpoint, like:
forward("/v1", to: V1)
inside of the V1 router, I have a forward to my auth handler:
forward("/auth", to: V1.Routes.Auth)
and my auth handler looks like:
I have facebook configured and when ever I go to the url:
/v1/auth/facebook
I get a 404. Now if I move that /auth forward in to main api router, then/auth/facebook
will work, but if I addV1
in front of that url, within theforward
at all, I get a 404. I have tried setting the base path in the config, and explicitly setting the paths for the facebook strategy config.Im not using Phoenix for this, it's pure plug.
The text was updated successfully, but these errors were encountered: