Broken Links when using forward plug
yordis opened this issue · comments
I have the following routing setup:
defmodule Web.Router do
use Web, :router
forward "/admin", Web.Admin.Router
forward "/api", Web.Api.Router
end
# .......
defmodule Web.Admin.Router do
use Web, :router
import Phoenix.LiveDashboard.Router
import Oban.Web.Router
pipeline :auth_pipe do
plug Web.Plug.BasicAuth
end
pipeline :html_pipe do
plug :fetch_session
plug :protect_from_forgery
end
scope "/" do
pipe_through [:auth_pipe]
scope "/" do
pipe_through [:html_pipe]
live_dashboard "/dashboard",
metrics: Web.Telemetry,
ecto_repos: Application.compile_env!(:my_app, :ecto_repos)
oban_dashboard "/oban", oban_name: Oban, as: :oban_dashboard
end
end
end
Environment
- Elixir version (elixir -v): 1.14.4
- Phoenix version (mix deps):
* absinthe_phoenix 2.0.2 (Hex package) (mix)
locked at 2.0.2 (absinthe_phoenix) d3691892
* phoenix 1.7.2 (Hex package) (mix)
locked at 1.7.2 (phoenix) 1ebca94b
* phoenix_ecto 4.4.1 (Hex package) (mix)
locked at 4.4.1 (phoenix_ecto) ddccf8b4
* phoenix_html 3.3.1 (Hex package) (mix)
locked at 3.3.1 (phoenix_html) bed1906e
* phoenix_live_dashboard 0.7.2 (Hex package) (mix)
locked at 0.7.2 (phoenix_live_dashboard) 0e5fdf06
* phoenix_live_view 0.18.18 (Hex package) (mix)
locked at 0.18.18 (phoenix_live_view) a5810d04
* phoenix_pubsub 2.1.1 (Hex package) (mix)
locked at 2.1.1 (phoenix_pubsub) 81367c6d
* phoenix_template 1.0.1 (Hex package) (mix)
locked at 1.0.1 (phoenix_template) 157dc078
* phoenix_view 2.0.2 (Hex package) (mix)
locked at 2.0.2 (phoenix_view) a929e723
Oban
* oban_web 2.9.6 (Hex package) (mix)
locked at 2.9.6 (oban/oban_web) be7917e9
- Operating system: MacOS Ventura
Expected behavior
When clicking any link either in the Phoenix Dashboard or Oban Dashboard, it removes the forward
section from the link:
Screen.Recording.2023-05-24.at.3.14.47.PM.mov
Actual behavior
The links and routing keeps the forward
section in the URLs
@chrismccord I wonder if anything could be done at the Phoenix level where we save the Router + forward
prefixes.
It feels odd figuring out how to deal with this tricky situation at the Dashboard level (it would mean that Oban needs to figure it out as well)
No?!
Take my stand with a grain of salt. I am ignorant of the complexity of what I am asking for the situation.
Phoenix does indeed handle this by storing the cascaded forward script_name in the conn down the chain, but this is specific to LV routes. I need to think more about how we could bridge both, but not sure atm