Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken Links when using forward plug #417

Open
yordis opened this issue May 24, 2023 · 2 comments · May be fixed by #418
Open

Broken Links when using forward plug #417

yordis opened this issue May 24, 2023 · 2 comments · May be fixed by #418

Comments

@yordis
Copy link

yordis commented May 24, 2023

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 chrismccord transferred this issue from phoenixframework/phoenix May 24, 2023
@yordis yordis linked a pull request May 29, 2023 that will close this issue
@yordis
Copy link
Author

yordis commented May 29, 2023

@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.

@chrismccord
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants