mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-10 21:46:46 +08:00
Group public routes under a common prefix (#974)
This commit is contained in:
parent
70dac97ce7
commit
fc8799ef8f
2 changed files with 14 additions and 9 deletions
|
@ -124,7 +124,7 @@ defmodule LivebookCLI.Server do
|
||||||
defp check_endpoint_availability(base_url) do
|
defp check_endpoint_availability(base_url) do
|
||||||
Application.ensure_all_started(:inets)
|
Application.ensure_all_started(:inets)
|
||||||
|
|
||||||
health_url = append_path(base_url, "/health")
|
health_url = append_path(base_url, "/public/health")
|
||||||
|
|
||||||
case Livebook.Utils.HTTP.request(:get, health_url) do
|
case Livebook.Utils.HTTP.request(:get, health_url) do
|
||||||
{:ok, status, _headers, body} ->
|
{:ok, status, _headers, body} ->
|
||||||
|
|
|
@ -20,7 +20,19 @@ defmodule LivebookWeb.Router do
|
||||||
plug :put_secure_browser_headers
|
plug :put_secure_browser_headers
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/", LivebookWeb do
|
# The /public namespace includes routes with no authentication.
|
||||||
|
# When exposing Livebook through an authentication proxy, this
|
||||||
|
# namespace should be configured as publicly available, in order
|
||||||
|
# for all features to work as expected.
|
||||||
|
|
||||||
|
scope "/public", LivebookWeb do
|
||||||
|
pipe_through :browser
|
||||||
|
|
||||||
|
get "/health", HealthController, :index
|
||||||
|
end
|
||||||
|
|
||||||
|
# The following routes are public, but should be treated as opaque
|
||||||
|
scope "/public", LivebookWeb do
|
||||||
pipe_through [:js_output_assets]
|
pipe_through [:js_output_assets]
|
||||||
|
|
||||||
get "/sessions/assets/:hash/*file_parts", SessionController, :show_cached_asset
|
get "/sessions/assets/:hash/*file_parts", SessionController, :show_cached_asset
|
||||||
|
@ -78,13 +90,6 @@ defmodule LivebookWeb.Router do
|
||||||
ecto_repos: []
|
ecto_repos: []
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public URLs without authentication
|
|
||||||
scope "/", LivebookWeb do
|
|
||||||
pipe_through :browser
|
|
||||||
|
|
||||||
get "/health", HealthController, :index
|
|
||||||
end
|
|
||||||
|
|
||||||
scope "/authenticate", LivebookWeb do
|
scope "/authenticate", LivebookWeb do
|
||||||
pipe_through :browser
|
pipe_through :browser
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue