Hapi: Remove support for multiple connection in a single server

Created on 14 Sep 2017  路  10Comments  路  Source: hapijs/hapi

hapi is (probably) the only framework that supports adding multiple ports to a single server instance. This was done for two use cases:

  • Support an internal process admin channel (serve normal API over port 8000 and allow internal admin access on port 8001)
  • Run multiple services in a single process for testing purposes (run a single server that have both your "login" and "billing" APIs, each on a different port)

At this point, external tools would do as good a job at allowing you to manage multiple servers, each with a single port.

breaking changes

Most helpful comment

I鈥檓 working heavily with hapi for several years now, I can鈥檛 recall a single situation where we had depended on the multiple connections. On the other side, I do recall it being a bit confusing when starting to work with hapi. If you were to remove this feature, I think the onboarding would be much easer. Big +1 from me 馃挴

All 10 comments

I鈥檓 working heavily with hapi for several years now, I can鈥檛 recall a single situation where we had depended on the multiple connections. On the other side, I do recall it being a bit confusing when starting to work with hapi. If you were to remove this feature, I think the onboarding would be much easer. Big +1 from me 馃挴

Would still be possible to spin up another server instance in the same process, no?

@kpdecker yep. Just need to reuse the config.

O agree 100% with @gr2m, I think the cognitive overload of multiple connections is not worth It.

I鈥檝e used this before and found it handy for the reasons outlined, but the workaround in https://github.com/hapijs/hapi/issues/3572#issuecomment-329413611 would be more than acceptable.

I too agree that the initial setup simplification alone is worth removing that feature.

We use this feature all the time to redirect http requests on port 80 to use ssl

I find it useful. I love that you can load plugins per connection. One use case is private routes for cache invalidation.

I like the possibility to load plugins for specific connections, too. Is there any other way to restrict the effect of a plugin to certain routes or path-prefixes (e.g. a plugin should only affect /admin/* routes)?

@mattii You just just losing the ability to select connections because there is always just one. The rest of the plugin options remain.

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arb picture arb  路  4Comments

jeffbski picture jeffbski  路  5Comments

jeremiahlee picture jeremiahlee  路  4Comments

taoeffect picture taoeffect  路  3Comments

leore picture leore  路  4Comments