Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glurp/dynamicreverseproxy
Exemple of a solution for dynamic Http/WS reverse proxy with nginx and /etc/hosts manipulation
https://github.com/glurp/dynamicreverseproxy
dynamic-reverse-proxy nginx ocpp openresty reverse-proxy websocket
Last synced: 26 days ago
JSON representation
Exemple of a solution for dynamic Http/WS reverse proxy with nginx and /etc/hosts manipulation
- Host: GitHub
- URL: https://github.com/glurp/dynamicreverseproxy
- Owner: glurp
- License: mit
- Created: 2021-09-09T15:03:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-09T15:55:33.000Z (over 3 years ago)
- Last Synced: 2024-10-30T06:27:25.364Z (2 months ago)
- Topics: dynamic-reverse-proxy, nginx, ocpp, openresty, reverse-proxy, websocket
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dynamicReverseProxy for Ocpp chargebox backend
Objective
========I have thousend equipments (EVSE/Ocpp/Soap/ws) on internet, which are supervised by some backends.
Each equipmement is affected to one backend.
A backend can change the list of equipment it supervise.
Each backend is on a distinct IP (same port(s) )For simplicity in installation, each equipment is configured with an unique backend URL ( https or wss ).
Unfortunatly, the ID of the equipement is not in http-header : it is in POST body data : Soap Header for http, URI for websocket
( this are requirement of Ocpp standard, whe cannot change that ! )So whe must dispose of a reverse-proxy, which can rerouting equipement request/connexion to his backend.
This seem do be a programmable reverse-proxy.
So here is a solution with minimum of developpement.
Solution
========**A)** A NGINX revers-proxy, with module LUA ( nginx become programmable ).
Use of OpenResty for dispose of a complete Nginx config.**B)** Backend send to a script ( by ssh ) his IP and the list of equipement ID.
**C)** when each backend have send his list, /etc/hosts is updated, white entry like :
```
. . . .
```
**D)** basic DNS in Debian distribution can expose this list, for nginx usage.**E1)** Http: Nginx find Id Equipment in the body of each request, and replace FDQN by the ID of the equipement, in the current URL.
**E2)** WS: Nginx find Id Equipment in the URI each request, and replace FDQN by the ID of the equipement, in the current URL.
**F**) Id equipement arre mappind to IP-backend, when Nginx incoke the local DND indicated.
That's it !
Sources provided
===============A nginx.conf
-------------
* ddns config
* http route with LUA code ( content_read_by_block )
* ws route, idemDebian installation
-------------------debian_install.md
scripts
-------
No sources provided, the lector can improvise :)