# Httpd\_router - A routing module for OTP's built-in httpd web server

**URL:** <https://erlangforums.com/t/httpd-router-a-routing-module-for-otps-built-in-httpd-web-server/5645>\
**Category:** Libraries\
**Tags:** httpd\
**Created:** [May 22, 2026, 1:41pm UTC](https://erlangforums.com/t/httpd-router-a-routing-module-for-otps-built-in-httpd-web-server/5645 "2026-05-22T13:41:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![etnt](https://erlangforums.com/user_avatar/erlangforums.com/etnt/32/892_2.png) [@etnt](https://erlangforums.com/u/etnt)\
**Post date:** [May 22, 2026, 1:41pm UTC](https://erlangforums.com/t/httpd-router-a-routing-module-for-otps-built-in-httpd-web-server/5645/1 "2026-05-22T13:41:22Z")

</div>

Erlang OTP comes with a built in webserver, the inets httpd server

`httpd_router` implements the `do/1` callback expected by the  
`httpd` module pipeline, providing clean, declarative routing without  
external dependencies.

Features:

- Declarative route registration with path patterns (e.g. `/users/:id`)

- Middleware chains for cross-cutting concerns (auth, logging, CORS)

- CRUD route shortcuts (`"CRUD"`, `"CR"`, `"RD"`, etc.)

- Automatic OPTIONS/CORS preflight handling (pending OTP patch issued…)

- Clean request context map passed to handlers

- Multiple named route tables for different server instances

- Streaming response support

- Configurable fallthrough behaviour (404 or passthrough to next module)

- Zero external dependencies — pure OTP

For all the details, including examples see here:

> **[GitHub - etnt/httpd\_router: Routing module for OTP's built-in httpd web server](https://github.com/etnt/httpd_router/)**
>
> Routing module for OTP's built-in httpd web server

---

<div class="post-metadata">

**Author:** ![Whaileee](https://erlangforums.com/user_avatar/erlangforums.com/whaileee/32/3057_2.png) [@Whaileee](https://erlangforums.com/u/Whaileee)\
**Post date:** [May 26, 2026, 7:30am UTC](https://erlangforums.com/t/httpd-router-a-routing-module-for-otps-built-in-httpd-web-server/5645/3 "2026-05-26T07:30:53Z")

</div>

I really like the idea! I think this would fit well for OTP’s httpd and perhaps “modernize” it.  
Stay tuned and have an eye out for inets PRs (or maybe try opening your own 😃)

Best regards,  
Konrad

---

<div class="post-metadata">

**Author:** ![mworrell](https://erlangforums.com/user_avatar/erlangforums.com/mworrell/32/267_2.png) [@mworrell](https://erlangforums.com/u/mworrell)\
**Post date:** [May 26, 2026, 10:01am UTC](https://erlangforums.com/t/httpd-router-a-routing-module-for-otps-built-in-httpd-web-server/5645/4 "2026-05-26T10:01:24Z")

</div>

Maybe also interesting to check our dispatch rule compiler:

> **[GitHub - zotonic/dispatch\_compiler: Compiles dispatch rules to an Erlang module for...](https://github.com/zotonic/dispatch_compiler)**
>
> Compiles dispatch rules to an Erlang module for quick dispatch matching.

---

<div class="post-metadata">

**Author:** ![lpil](https://erlangforums.com/user_avatar/erlangforums.com/lpil/32/222_2.png) [@lpil](https://erlangforums.com/u/lpil)\
**Post date:** [May 26, 2026, 10:14am UTC](https://erlangforums.com/t/httpd-router-a-routing-module-for-otps-built-in-httpd-web-server/5645/5 "2026-05-26T10:14:38Z")

</div>

Very cool!

Do you have any guidance as to when one might pick httpd over the third party http servers such as Elli, Cowboy, etc?

---

<div class="post-metadata">

**Author:** ![Whaileee](https://erlangforums.com/user_avatar/erlangforums.com/whaileee/32/3057_2.png) [@Whaileee](https://erlangforums.com/u/Whaileee)\
**Post date:** [May 26, 2026, 10:27am UTC](https://erlangforums.com/t/httpd-router-a-routing-module-for-otps-built-in-httpd-web-server/5645/6 "2026-05-26T10:27:12Z")

</div>

I think the most obvious answer for me is “pick httpd over something else, when you want to limit the amount of 3pps and external dependencies as much as possible”. We aim to improve the inets application as a whole, but there is so much we can do, without creating a new client/server. I think the goal is to make both client and server usable and stable, and by doing so, not give users too many headaches.

Best regards,  
Konrad

---

<div class="post-metadata">

**Author:** ![lpil](https://erlangforums.com/user_avatar/erlangforums.com/lpil/32/222_2.png) [@lpil](https://erlangforums.com/u/lpil)\
**Post date:** [May 26, 2026, 10:39am UTC](https://erlangforums.com/t/httpd-router-a-routing-module-for-otps-built-in-httpd-web-server/5645/7 "2026-05-26T10:39:15Z")

</div>

Aye, but what is the trade off there? I always want fewer dependencies, so if that’s the only consideration I always want to use httpd.

Lack of HTTP2/3, SSE, and WS are one thing. Is there anything else? Perhaps httpd has significant performance limitations or resource usage?

---

<div class="post-metadata">

**Author:** ![Whaileee](https://erlangforums.com/user_avatar/erlangforums.com/whaileee/32/3057_2.png) [@Whaileee](https://erlangforums.com/u/Whaileee)\
**Post date:** [May 26, 2026, 11:31am UTC](https://erlangforums.com/t/httpd-router-a-routing-module-for-otps-built-in-httpd-web-server/5645/8 "2026-05-26T11:31:26Z")

</div>

I cannot think of any obvious performace/memory limitations inside of httpd, from the top of my head. Inets’ httpd was designed **some time** ago and is constantly improved and maintained. It is a good choice if it fits your needs (HTTP/1.1, no WS). I am sure, the best way to know for yourself if httpd is good enough for you, in the end, is to do your own benchmarks. My reason for that is, who else if not you yourself, understands your needs better. From my point of view, httpc and httpd were never designed to be _blazingly fast_, but that doesn’t mean it won’t be good enough for the use case you are after.

---

<div class="post-metadata">

**Author:** ![etnt](https://erlangforums.com/user_avatar/erlangforums.com/etnt/32/892_2.png) [@etnt](https://erlangforums.com/u/etnt)\
**Post date:** [May 26, 2026, 1:55pm UTC](https://erlangforums.com/t/httpd-router-a-routing-module-for-otps-built-in-httpd-web-server/5645/9 "2026-05-26T13:55:44Z")

</div>

Here are some numbers:

> [@Roadrunner - Pure-Erlang HTTP and WebSocket server](https://erlangforums.com/t/roadrunner-pure-erlang-http-and-websocket-server/5623/13):
>
> Hey @etnt! I ran roadrunner against the built-in httpd, using the same load test we use for cowboy and elli. Two httpd setups: plain httpd (a small hand-written do/1, no extra deps) and httpd + httpd\_router. Median of 3 runs, 50 clients, HTTP/1.1, loopback, OTP 29 (req/s, higher is better): scenario roadrunner httpd httpd + httpd\_router hello 292k 183k 178k json 266k 164k 156k echo 253k 149k 138k routing, 100 paths 244k 150k 64k A few friendly notes: The built-in server is …
