Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

HTTP2 proxy for loopback using two ways, native node:http2 and fastify http2 server.

Notifications You must be signed in to change notification settings

shubhamp-sf/loopback-http2-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Checkout this blog for http2 support in lb4 app: https://blog.shubhamp.dev/how-to-use-http2-in-loopback-4-applications Related Thread: loopbackio/loopback-next#9067

http/2 proxy for loopback

Proxy code for forwarding HTTP2 requests to loopback, in two ways:

  1. Internal node:http2
  2. Fastify's http2 server
Check Out the Request Flow

Request Flow

image

Directory Structure

.
├── loopback-http2-proxy/ (• this repository)
│   └── src
│       ├── native-http2.ts
|           └── H2 Server having requests forwarded to lb4 app using node's internal http2.
│       └── fastify-http2.ts
|           └── H2 Server having requests forwarded to lb4 app using fastify.
└── default-app/ (loopback app to forward requests to)
    └── (...normal loopback app)

Changes required in Loopback App

TODO

Current Supoprt

  • GET routes with returned responses
  • GET routes with responses send() directly to http by loopback.
  • Translated http/1 Headers
  • Cookies
  • Status Codes
  • Static Responses (to support this.static('/', "index.html"))
  • Streamed Responses (Readable streams)
  • ...(more to come)

What has been tested?

An lb4 app sourced here is being used to test different routes and responses.

  • REST Controller with CRUD functions (Datasource: Postgres) source

    • @post('/users')
    • @get('/users')
    • @get('/users/count')
    • @patch('/users')
    • @get('/users/{id}')
    • @patch('/users/{id}')
    • @put('/users/{id}')
    • @del('/users/{id}')
  • Default Ping Controller

About

HTTP2 proxy for loopback using two ways, native node:http2 and fastify http2 server.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published