{"id":15971149,"url":"https://github.com/glurp/dynamicreverseproxy","last_synced_at":"2025-04-04T15:43:16.928Z","repository":{"id":141874773,"uuid":"404766429","full_name":"glurp/dynamicReverseProxy","owner":"glurp","description":"Exemple of a solution for dynamic Http/WS reverse proxy with nginx and /etc/hosts manipulation","archived":false,"fork":false,"pushed_at":"2021-09-09T15:55:33.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T01:37:54.656Z","etag":null,"topics":["dynamic-reverse-proxy","nginx","ocpp","openresty","reverse-proxy","websocket"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glurp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-09-09T15:03:45.000Z","updated_at":"2024-09-18T21:48:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"2c5527f2-60f4-4013-b48c-cf385b491593","html_url":"https://github.com/glurp/dynamicReverseProxy","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"818696cbd012df71027acd21f96316859353da8c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glurp%2FdynamicReverseProxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glurp%2FdynamicReverseProxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glurp%2FdynamicReverseProxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glurp%2FdynamicReverseProxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glurp","download_url":"https://codeload.github.com/glurp/dynamicReverseProxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208018,"owners_count":20901568,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dynamic-reverse-proxy","nginx","ocpp","openresty","reverse-proxy","websocket"],"created_at":"2024-10-07T20:08:07.144Z","updated_at":"2025-04-04T15:43:16.900Z","avatar_url":"https://github.com/glurp.png","language":null,"readme":"# dynamicReverseProxy for Ocpp chargebox backend\n\n\nObjective\n========\n\nI have thousend equipments (EVSE/Ocpp/Soap/ws) on internet, which are supervised by some backends.\nEach equipmement is affected to one backend.\nA backend can change the list of equipment it supervise.\nEach backend is on a distinct IP (same port(s) )\n\nFor simplicity in installation, each equipment is configured with an unique backend URL ( https or wss ).\n\nUnfortunatly, the ID of the equipement is not in http-header : it is in POST body data : Soap Header for http, URI for websocket\n( this are requirement of Ocpp standard, whe cannot change that ! )\n\nSo whe must dispose of a reverse-proxy, which can rerouting equipement request/connexion to his backend.\n\nThis seem do be a programmable reverse-proxy.\n\nSo here is a solution with minimum of developpement.\n\nSolution\n========\n\n**A)** A NGINX  revers-proxy, with module LUA (  nginx become programmable ). \nUse of OpenResty for dispose of a complete Nginx config.\n\n**B)** Backend send to a script ( by ssh )  his IP and the list of equipement ID.\n\n**C)** when each backend have send his list, /etc/hosts is updated, white entry like :\n\n```\n\u003cIP backend1\u003e   \u003cID equipmement1\u003e\n\u003cIP backend1\u003e   \u003cID equipmement10\u003e\n\u003cIP backend2\u003e   \u003cID equipmement2\u003e\n . . . .  \n```\n**D)** basic DNS in Debian distribution can expose this list, for nginx usage.\n\n**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.\n\n**E2)** WS: Nginx find Id Equipment in the URI  each request, and replace FDQN by the ID of the equipement, in the current URL.\n\n**F**) Id equipement arre mappind to IP-backend, when Nginx incoke the local DND indicated. \n\nThat's it !\n\n\nSources provided\n===============\n\nA nginx.conf\n-------------\n* ddns config\n* http route with LUA code ( content_read_by_block )\n* ws route, idem\n\nDebian installation\n-------------------\n\ndebian_install.md\n\nscripts\n-------\nNo sources provided, the lector can improvise :)\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglurp%2Fdynamicreverseproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglurp%2Fdynamicreverseproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglurp%2Fdynamicreverseproxy/lists"}