# \#router

**URL:** https://forum.elixirforum.com/tag/router/268.md

[Latest](https://forum.elixirforum.com/latest.md) · [Categories](https://forum.elixirforum.com/categories.md) · [Tags](https://forum.elixirforum.com/tags.md)

---

## [Plug\_deflect - deflect invalid traffic](https://forum.elixirforum.com/t/plug-deflect-deflect-invalid-traffic/75372)

<div class="topic-metadata">

**Author:** [@afomi](https://forum.elixirforum.com/u/afomi)\
**Replies:** 4\
**Last updated:** [May 16, 2026, 1:54pm UTC](https://forum.elixirforum.com/t/plug-deflect-deflect-invalid-traffic/75372 "2026-05-16T13:54:36Z")

</div>

After doing this a 3rd time, I packaged a small library; a plug that deflects common sources of invalid traffic before it hits the router. I’m curious how others are approaching this. And, I’d appreciate feedback, here…

---

## [Hologram router - possible to have a route like /:username at the root? (+ some misc feedback)](https://forum.elixirforum.com/t/hologram-router-possible-to-have-a-route-like-username-at-the-root-some-misc-feedback/74770)

<div class="topic-metadata">

**Author:** [@sodapopcan](https://forum.elixirforum.com/u/sodapopcan)\
**Replies:** 4\
**Last updated:** [March 24, 2026, 9:51pm UTC](https://forum.elixirforum.com/t/hologram-router-possible-to-have-a-route-like-username-at-the-root-some-misc-feedback/74770 "2026-03-24T21:51:48Z")

</div>

As someone who had a lot of initial interest in Hologram, I’m only just diving into it now. It’s feeling magical being able to write Elixir in the template and have it update on the client. I’m still getting used to it…

---

## [Phoenix VerifiedRoutes and routes localization](https://forum.elixirforum.com/t/phoenix-verifiedroutes-and-routes-localization/74632)

<div class="topic-metadata">

**Author:** [@Gigitsu](https://forum.elixirforum.com/u/Gigitsu)\
**Replies:** 5\
**Last updated:** [March 17, 2026, 11:23am UTC](https://forum.elixirforum.com/t/phoenix-verifiedroutes-and-routes-localization/74632 "2026-03-17T11:23:05Z")

</div>

I was reading the Localized routes and path prefixes section of the Phoenix.VerifiedRoutes and I found this line: In this case, you would have a plug that looks at the host and at HTTP headers and calls Gettext.get\_loc…

---

## [Using :host parameter for matching routes](https://forum.elixirforum.com/t/using-host-parameter-for-matching-routes/33066)

<div class="topic-metadata">

**Author:** [@ericteubert](https://forum.elixirforum.com/u/ericteubert)\
**Replies:** 2\
**Last updated:** [July 14, 2020, 7:00am UTC](https://forum.elixirforum.com/t/using-host-parameter-for-matching-routes/33066 "2020-07-14T07:00:28Z")

</div>

Hi, My use case: I allow CNAMEs in my app, allowing users to bring their own hostname for public pages. My idea then was to use host in all scopes for my native routes and a scope that matches any host for routes that …

---

## [Routex 1.3.2 fixes warnings when using Elixir 1.20+](https://forum.elixirforum.com/t/routex-1-3-2-fixes-warnings-when-using-elixir-1-20/74103)

<div class="topic-metadata">

**Author:** [@BartOtten](https://forum.elixirforum.com/u/BartOtten)\
**Replies:** 0\
**Last updated:** [January 27, 2026, 8:01pm UTC](https://forum.elixirforum.com/t/routex-1-3-2-fixes-warnings-when-using-elixir-1-20/74103 "2026-01-27T20:01:53Z")

</div>

Routex 1.3.2 has been released. It’s main focus was getting rid of warnings in Elixir 1.20 and completing a long standing todo to overhaul the macro branching module. Bug Fixes: core: matchable type warning in Elixir 1…

---

## [Conditional routes in router.ex](https://forum.elixirforum.com/t/conditional-routes-in-router-ex/71533)

<div class="topic-metadata">

**Author:** [@marcuslankenau](https://forum.elixirforum.com/u/marcuslankenau)\
**Replies:** 1\
**Last updated:** [July 2, 2025, 12:26pm UTC](https://forum.elixirforum.com/t/conditional-routes-in-router-ex/71533 "2025-07-02T12:26:22Z")

</div>

Hello, I’m currently in the process of rewriting parts of a Phoenix application. The frontend is primarily a React single-page app, but we’re transitioning to LiveView. To ensure a smooth rollout, I’d like to migrate sp…

---

## [Phoenix named routes only the last part](https://forum.elixirforum.com/t/phoenix-named-routes-only-the-last-part/70697)

<div class="topic-metadata">

**Author:** [@andresgutgon](https://forum.elixirforum.com/u/andresgutgon)\
**Replies:** 1\
**Last updated:** [May 1, 2025, 2:42pm UTC](https://forum.elixirforum.com/t/phoenix-named-routes-only-the-last-part/70697 "2025-05-01T14:42:20Z")

</div>

Hi, nice to meet you. This is my first question in the forum :waving\_hand: I’m trying to develop a package for Phoenix to generate routes in typescript files to be used in my frontend which is done with Inertia.js. What…

---

## [Seeking your thoughts on Routex 1.2 pre-releases - localize Phoenix with minimal config](https://forum.elixirforum.com/t/seeking-your-thoughts-on-routex-1-2-pre-releases-localize-phoenix-with-minimal-config/53928)

<div class="topic-metadata">

**Author:** [@BartOtten](https://forum.elixirforum.com/u/BartOtten)\
**Replies:** 33\
**Last updated:** [May 1, 2025, 9:10am UTC](https://forum.elixirforum.com/t/seeking-your-thoughts-on-routex-1-2-pre-releases-localize-phoenix-with-minimal-config/53928 "2025-05-01T09:10:29Z")

</div>

This thread once discussed Routex in it’s early form. It has been repurposed to gather feedback and discusses pre-releases. Currently: pre 1.2.0 Target: localization with auto-detection of already used libs (Cldr, Gett…

---

## [Router based on host](https://forum.elixirforum.com/t/router-based-on-host/70282)

<div class="topic-metadata">

**Author:** [@dacz](https://forum.elixirforum.com/u/dacz)\
**Replies:** 13\
**Last updated:** [April 10, 2025, 7:44pm UTC](https://forum.elixirforum.com/t/router-based-on-host/70282 "2025-04-10T19:44:10Z")

</div>

I’m building an app that would handle request for bare domain as well as for subdomains. Each subdomain is client space. I have very different requirements for bare domain routing and for subdomain routing (same paths w…

---

## [Fast\_postman\_collection - Generative collection for Postman by Phoenix Router](https://forum.elixirforum.com/t/fast-postman-collection-generative-collection-for-postman-by-phoenix-router/63137)

<div class="topic-metadata">

**Author:** [@kalachlegends](https://forum.elixirforum.com/u/kalachlegends)\
**Replies:** 6\
**Last updated:** [April 5, 2025, 5:43am UTC](https://forum.elixirforum.com/t/fast-postman-collection-generative-collection-for-postman-by-phoenix-router/63137 "2025-04-05T05:43:19Z")

</div>

This library helps you generate a Postman collection from your Phoenix router (MyApp.Router). You can document your endpoints using @doc annotations for params, body, form data, and more. Pipelines (plugs) can also be …

---

## [Allow forwarded to plugs to have a callback that returns additional routes](https://forum.elixirforum.com/t/allow-forwarded-to-plugs-to-have-a-callback-that-returns-additional-routes/65365)

<div class="topic-metadata">

**Author:** [@zachdaniel](https://forum.elixirforum.com/u/zachdaniel)\
**Replies:** 7\
**Last updated:** [March 15, 2025, 5:26pm UTC](https://forum.elixirforum.com/t/allow-forwarded-to-plugs-to-have-a-callback-that-returns-additional-routes/65365 "2025-03-15T17:26:05Z")

</div>

Something we do in various Ash packages is provide routes that the user forwards to in their own application. This is because we are deriving routes based on other configuration, and we don’t want to make the router have…

---

## [Best practices for routes with multi-domain routers?](https://forum.elixirforum.com/t/best-practices-for-routes-with-multi-domain-routers/69541)

<div class="topic-metadata">

**Author:** [@sparkertime](https://forum.elixirforum.com/u/sparkertime)\
**Replies:** 4\
**Last updated:** [February 22, 2025, 4:50pm UTC](https://forum.elixirforum.com/t/best-practices-for-routes-with-multi-domain-routers/69541 "2025-02-22T16:50:23Z")

</div>

My Phoenix app has a variety of scopes distinguished by host as follows: scope "/", LockerWeb, host: "host.example.com" do pipe\_through :inertia get "/", HostController, :index get "/connect", HostControl…

---

## [How to verify routes from multiple routers?](https://forum.elixirforum.com/t/how-to-verify-routes-from-multiple-routers/67982)

<div class="topic-metadata">

**Author:** [@kamaroly](https://forum.elixirforum.com/u/kamaroly)\
**Replies:** 5\
**Last updated:** [December 10, 2024, 3:11pm UTC](https://forum.elixirforum.com/t/how-to-verify-routes-from-multiple-routers/67982 "2024-12-10T15:11:30Z")

</div>

Hi all, I am working on an application with routers separated by their domain. The application has MyApp.Expenses.Router, MyApp.Inventory.Router etc.. I have written a plug to redirect the traffic to the right router …

---

## [Dynamically setting a plug in the Phoenix router](https://forum.elixirforum.com/t/dynamically-setting-a-plug-in-the-phoenix-router/67707)

<div class="topic-metadata">

**Author:** [@brucepomeroy](https://forum.elixirforum.com/u/brucepomeroy)\
**Replies:** 2\
**Last updated:** [November 27, 2024, 3:16am UTC](https://forum.elixirforum.com/t/dynamically-setting-a-plug-in-the-phoenix-router/67707 "2024-11-27T03:16:16Z")

</div>

In the phoenix router I want to define a plug for a pipeline. I want to use a different implementation of the plug module in the test environment so I have defined the plug in compile.exs and overridden it in test.exs. S…

---

## [Phoenix Localized Routes - Localized/multilingual routes in Phoenix](https://forum.elixirforum.com/t/phoenix-localized-routes-localized-multilingual-routes-in-phoenix/48486)

<div class="topic-metadata">

**Author:** [@BartOtten](https://forum.elixirforum.com/u/BartOtten)\
**Replies:** 23\
**Last updated:** [November 4, 2024, 8:07pm UTC](https://forum.elixirforum.com/t/phoenix-localized-routes-localized-multilingual-routes-in-phoenix/48486 "2024-11-04T20:07:09Z")

</div>

Phoenix Localized Routes is dead. Long live Routex! Phoenix Localized Routes did pave the way for some routing libs but that was possibly it’s only award. As it was the first of it’s kind the design very much left much t…

---

## [How can I set local defaults when local config is compile-time and production uses runtime config?](https://forum.elixirforum.com/t/how-can-i-set-local-defaults-when-local-config-is-compile-time-and-production-uses-runtime-config/59877)

<div class="topic-metadata">

**Author:** [@budgie](https://forum.elixirforum.com/u/budgie)\
**Replies:** 14\
**Last updated:** [October 29, 2024, 6:20am UTC](https://forum.elixirforum.com/t/how-can-i-set-local-defaults-when-local-config-is-compile-time-and-production-uses-runtime-config/59877 "2024-10-29T06:20:03Z")

</div>

I’m trying to find out a good way to manage config in production, but the default Dockerfile from mix phx.gen.release --docker\` compiles everything under /config into the release except for config/runtime.exs. For exampl…

---

## [Different subdomains for admins and users](https://forum.elixirforum.com/t/different-subdomains-for-admins-and-users/66365)

<div class="topic-metadata">

**Author:** [@OmarGoubail](https://forum.elixirforum.com/u/OmarGoubail)\
**Replies:** 10\
**Last updated:** [September 30, 2024, 8:50am UTC](https://forum.elixirforum.com/t/different-subdomains-for-admins-and-users/66365 "2024-09-30T08:50:23Z")

</div>

Hello, I am working on an app and I want to separate admin and user routes to different subdomains, I found an article how-to-serve-multiple-domains-in-a-single-phoenix-app It got me part of the way there, but for some r…

---

## [Structuring LiveViews and routes for multi-step process with and without back button](https://forum.elixirforum.com/t/structuring-liveviews-and-routes-for-multi-step-process-with-and-without-back-button/66347)

<div class="topic-metadata">

**Author:** [@Almah](https://forum.elixirforum.com/u/Almah)\
**Replies:** 1\
**Last updated:** [September 27, 2024, 9:35am UTC](https://forum.elixirforum.com/t/structuring-liveviews-and-routes-for-multi-step-process-with-and-without-back-button/66347 "2024-09-27T09:35:15Z")

</div>

This is in the context of a tabletop roleplaying game, think Dungeons & Dragons. In such a game you create a character by going through a branching multi-step process such as determining attributes, picking a species, se…

---

## [Default (optional) param value in route definition](https://forum.elixirforum.com/t/default-optional-param-value-in-route-definition/31001)

<div class="topic-metadata">

**Author:** [@thiagomajesk](https://forum.elixirforum.com/u/thiagomajesk)\
**Replies:** 8\
**Last updated:** [September 10, 2024, 12:44pm UTC](https://forum.elixirforum.com/t/default-optional-param-value-in-route-definition/31001 "2024-09-10T12:44:11Z")

</div>

Hi everyone! I’m trying to find a way to add a default value on a route param in Phoenix. I’ve searched in the forum but couldn’t find an exact match to what I’m seeking. Example: Let’s suppose there’s a page that shows…

---

## [Suggestion: Verified Routes with Subdomain Support](https://forum.elixirforum.com/t/suggestion-verified-routes-with-subdomain-support/65786)

<div class="topic-metadata">

**Author:** [@krainboltgreene](https://forum.elixirforum.com/u/krainboltgreene)\
**Replies:** 1\
**Last updated:** [August 30, 2024, 8:35pm UTC](https://forum.elixirforum.com/t/suggestion-verified-routes-with-subdomain-support/65786 "2024-08-30T20:35:17Z")

</div>

So verified paths is geniuenly one of the best features of a web framework I’ve ever seen in ~15 years, but I’ve encountered a place where it gets kinda tricky! So imagine this router: defmodule CoreWeb.Router do use…

---

## [I want to have two routes for accessing error\_tracker dashboard](https://forum.elixirforum.com/t/i-want-to-have-two-routes-for-accessing-error-tracker-dashboard/65726)

<div class="topic-metadata">

**Author:** [@Wojciech](https://forum.elixirforum.com/u/Wojciech)\
**Replies:** 4\
**Last updated:** [August 30, 2024, 11:06am UTC](https://forum.elixirforum.com/t/i-want-to-have-two-routes-for-accessing-error-tracker-dashboard/65726 "2024-08-30T11:06:56Z")

</div>

I want admins to have access to error\_tracker’s dashboard and i also want the dashboard to be generally available in development environment, it seems i can’t use error\_tracker\_dashboard("/errors") two times as it create…

---

## [Phoenix redirect takes me away from subdomain](https://forum.elixirforum.com/t/phoenix-redirect-takes-me-away-from-subdomain/64949)

<div class="topic-metadata">

**Author:** [@travisf](https://forum.elixirforum.com/u/travisf)\
**Replies:** 4\
**Last updated:** [July 19, 2024, 7:21pm UTC](https://forum.elixirforum.com/t/phoenix-redirect-takes-me-away-from-subdomain/64949 "2024-07-19T19:21:21Z")

</div>

I am working on converting an existing application to a multi-tenant one with subdomains enforcing the organization. Tenants have an “admin” panel but can also impersonate their own customers via an impersonator session…

---

## [Phoenix Router should warn or error on missing modules](https://forum.elixirforum.com/t/phoenix-router-should-warn-or-error-on-missing-modules/64601)

<div class="topic-metadata">

**Author:** [@sevensidedmarble](https://forum.elixirforum.com/u/sevensidedmarble)\
**Replies:** 2\
**Last updated:** [July 2, 2024, 1:44am UTC](https://forum.elixirforum.com/t/phoenix-router-should-warn-or-error-on-missing-modules/64601 "2024-07-02T01:44:27Z")

</div>

Hello: simple request. The router should warn about modules that don’t exist (like and LV that has been deleted). since it’s compiled time I feel like this should be possible.

---

## [Non-HTML routes on \`live\` paths](https://forum.elixirforum.com/t/non-html-routes-on-live-paths/63884)

<div class="topic-metadata">

**Author:** [@hauleth](https://forum.elixirforum.com/u/hauleth)\
**Replies:** 6\
**Last updated:** [May 31, 2024, 6:33am UTC](https://forum.elixirforum.com/t/non-html-routes-on-live-paths/63884 "2024-05-31T06:33:53Z")

</div>

I am working on a service where I want to serve multiple file formats from the same endpoint, depending on what content type user will negotiate. The goal there is to not duplicate endpoints where it is not needed. Howev…

---

## [Named routes with sigil\_p](https://forum.elixirforum.com/t/named-routes-with-sigil-p/61701)

<div class="topic-metadata">

**Author:** [@amaterasu](https://forum.elixirforum.com/u/amaterasu)\
**Replies:** 10\
**Last updated:** [February 20, 2024, 8:56am UTC](https://forum.elixirforum.com/t/named-routes-with-sigil-p/61701 "2024-02-20T08:56:33Z")

</div>

I have an umbrella project with N apps, all with the same web structure, but different db and possibly language. Since the templates are all the same, I thought of creating a common app and I’m using templates like this…

---

## [Deep dive on the Phoenix Router, what makes the macros tick, the endpoint, cowboy/bandit, and more](https://forum.elixirforum.com/t/deep-dive-on-the-phoenix-router-what-makes-the-macros-tick-the-endpoint-cowboy-bandit-and-more/61615)

<div class="topic-metadata">

**Author:** [@sevensidedmarble](https://forum.elixirforum.com/u/sevensidedmarble)\
**Replies:** 2\
**Last updated:** [February 20, 2024, 4:08am UTC](https://forum.elixirforum.com/t/deep-dive-on-the-phoenix-router-what-makes-the-macros-tick-the-endpoint-cowboy-bandit-and-more/61615 "2024-02-20T04:08:02Z")

</div>

Hey yall, this one took me a while to make so I hope you like it. It’s a bit of a reference on working with the Phoenix router, going from top to bottom through the docs and from the http server, to the endpoint, to the…

---

## [Conditional forward in Router based on run-time configuration](https://forum.elixirforum.com/t/conditional-forward-in-router-based-on-run-time-configuration/27167)

<div class="topic-metadata">

**Author:** [@stefpankov](https://forum.elixirforum.com/u/stefpankov)\
**Replies:** 3\
**Last updated:** [February 15, 2024, 6:01am UTC](https://forum.elixirforum.com/t/conditional-forward-in-router-based-on-run-time-configuration/27167 "2024-02-15T06:01:34Z")

</div>

I need to use the forward macro in my application’s router only if a configuration flag is true, otherwise I don’t need to forward. I’ve set the config flag to my Endpoint and am trying to access it in the router module …

---

## [Phoenix route path with suffix (can route be made to look like static .html file?)](https://forum.elixirforum.com/t/phoenix-route-path-with-suffix-can-route-be-made-to-look-like-static-html-file/61261)

<div class="topic-metadata">

**Author:** [@Udi](https://forum.elixirforum.com/u/Udi)\
**Replies:** 4\
**Last updated:** [January 27, 2024, 5:48am UTC](https://forum.elixirforum.com/t/phoenix-route-path-with-suffix-can-route-be-made-to-look-like-static-html-file/61261 "2024-01-27T05:48:51Z")

</div>

I have routes that look like this: get("/post/:slug\_and\_id", PostController, :show) get("/post/:slug\_and\_id/comment/:comment\_id", PostController, :comment) Instead of getting urls like /post/my-post-slug-123 …

---

## [Redirecting from external URL remaining authenticated](https://forum.elixirforum.com/t/redirecting-from-external-url-remaining-authenticated/60911)

<div class="topic-metadata">

**Author:** [@AGURRU](https://forum.elixirforum.com/u/AGURRU)\
**Replies:** 9\
**Last updated:** [January 15, 2024, 3:06pm UTC](https://forum.elixirforum.com/t/redirecting-from-external-url-remaining-authenticated/60911 "2024-01-15T15:06:51Z")

</div>

Hi I am struggling to achieve the flow that I would like. I have a form that a user submits and if successful I redirect the user to an external url to complete some actions. This external url can POST back to my site v…

---

## [Liveview redirect root "/" to specific page](https://forum.elixirforum.com/t/liveview-redirect-root-to-specific-page/59747)

<div class="topic-metadata">

**Author:** [@hoetmaaiers](https://forum.elixirforum.com/u/hoetmaaiers)\
**Replies:** 8\
**Last updated:** [November 16, 2023, 10:55am UTC](https://forum.elixirforum.com/t/liveview-redirect-root-to-specific-page/59747 "2023-11-16T10:55:34Z")

</div>

I want to redirect the Phoenix router to a specific page so “/” renders the first navigation item. Currently I do this using a root page: # router.ex defmodule AppWeb.Router do ... scope "/", AppWeb do pipe\_th…

[Next page](https://forum.elixirforum.com/tag/router/268.md?match_all_tags=true&page=1&tags%5B%5D=router)
