{"id":45893046,"url":"https://github.com/tang-jie/NettyGateway","last_synced_at":"2026-03-13T06:00:52.048Z","repository":{"id":42653958,"uuid":"130069687","full_name":"tang-jie/NettyGateway","owner":"tang-jie","description":"NettyGateway is a HTTP proxy server with flexible routing rules.","archived":false,"fork":false,"pushed_at":"2018-04-24T02:19:27.000Z","size":256,"stargazers_count":97,"open_issues_count":2,"forks_count":56,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-11T20:04:48.160Z","etag":null,"topics":["http-proxy","netty","router"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tang-jie.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}},"created_at":"2018-04-18T13:50:56.000Z","updated_at":"2025-07-28T22:06:00.000Z","dependencies_parsed_at":"2022-08-31T20:51:49.616Z","dependency_job_id":null,"html_url":"https://github.com/tang-jie/NettyGateway","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tang-jie/NettyGateway","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tang-jie%2FNettyGateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tang-jie%2FNettyGateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tang-jie%2FNettyGateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tang-jie%2FNettyGateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tang-jie","download_url":"https://codeload.github.com/tang-jie/NettyGateway/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tang-jie%2FNettyGateway/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30459760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T03:55:51.346Z","status":"ssl_error","status_checked_at":"2026-03-13T03:55:33.055Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["http-proxy","netty","router"],"created_at":"2026-02-27T19:00:39.316Z","updated_at":"2026-03-13T06:00:52.036Z","avatar_url":"https://github.com/tang-jie.png","language":"Java","funding_links":[],"categories":["网络编程"],"sub_categories":["Spring Cloud框架"],"readme":"# NettyGateway\n* English：NettyGateway is a HTTP proxy server with flexible routing rules.\n* Chinese：基于Netty编写的轻量级HTTP代理转发服务器，可以根据请求的内容关键字进行定制化的规则路由。相比于Nginx（OpenResty）通过lua脚本配置方式，进行的规则路由而言，配置更加简单。\n\n----------\n\n## 如何用Netty实现一个轻量级的HTTP代理服务器\n有兴趣的朋友可以点击查看：https://www.cnblogs.com/jietang/p/8926325.html\n\n----------\n\n## NettyGateway配置说明\n* NettyGateway默认启动端口8999，你可以通过[netty-gateway.xml](https://github.com/tang-jie/NettyGateway/blob/master/src/main/resources/netty-gateway.xml)的gatewayPort属性进行配置。\n* 配置文件[netty-gateway.properties](https://github.com/tang-jie/NettyGateway/blob/master/src/main/resources/netty-gateway.properties)，主要用来定义http post请求中url的路径（path）部分serverPath，以及当请求报文关键字没有匹配成功的时候，默认转发的URL地址defaultAddr。\n* 配置文件[netty-route.properties](https://github.com/tang-jie/NettyGateway/blob/master/src/main/resources/netty-route.properties)，主要用来定义http post请求中url的路径（path）部分serverPath（路径部分定义必须在netty-gateway.properties中定义过），以及当请求报文关键字keyWord匹配成功的时候，路由转发的URL地址matchAddr。\n\n----------\n\n## NettyGateway代理转发场景描述\n* NettyGateway部署在10.1.1.76主机，URL中的路径为：fcgi-bin/BSSP_SFC\n* 如果请求报文中出现HelloWorldNettyGateway关键字的时候，转发到http://10.46.158.20:8089/fcgi-bin/BSSP_SFC\n* 否则转发到http://10.46.158.10:8089/fcgi-bin/BSSP_SFC\n\n----------\n\n## NettyGateway代理转发场景配置说明\n* 配置文件[netty-gateway.properties](https://github.com/tang-jie/NettyGateway/blob/master/src/main/resources/netty-gateway.properties)新增如下属性：\n~~~~~~~~~~java\n#配置说明参考：\n#netty-gateway.config2.serverPath ==\u003e URL路径关键字。\n#netty-gateway.config2.defaultAddr ==\u003e 请求报文中的关键字没有匹配成功时，默认转发的URL地址。\nnetty-gateway.config2.serverPath=fcgi-bin/BSSP_SFC\nnetty-gateway.config2.defaultAddr=http://10.46.158.10:8089/fcgi-bin/BSSP_SFC\n#注意config中的数字顺序递增即可。\n~~~~~~~~~~\n\n* 配置文件[netty-route.properties](https://github.com/tang-jie/NettyGateway/blob/master/src/main/resources/netty-route.properties)新增如下属性：\n~~~~~~~~~~java\n#配置说明参考：\n#netty-gateway.config3.serverPath ==\u003e URL路径关键字。\n#netty-gateway.config3.keyWord ==\u003e 请求报文匹配关键字。支持1~N个关键字，多个关键字用逗号分割，关键字之间是逻辑与的关系。\n#netty-gateway.config3.matchAddr ==\u003e 请求报文关键字匹配成功时，转发的ULR地址。\nnetty-gateway.config3.serverPath=fcgi-bin/BSSP_SFC\nnetty-gateway.config3.keyWord=HelloWorldNettyGateway\nnetty-gateway.config3.matchAddr=http://10.46.158.20:8089/fcgi-bin/BSSP_SFC\n#注意config中的数字顺序递增即可。\n~~~~~~~~~~\n\n## NettyGateway代理转发测试\n* 启动NettyGateway服务器，控制台打印如下信息\n![](https://github.com/tang-jie/NettyGateway/blob/master/docs/netty-gateway-1.jpg)\n* 发送HelloWorldNettyGateway到NettyGateway，关键字匹配成功，路由到http://10.46.158.20:8089/fcgi-bin/BSSP_SFC\n![](https://github.com/tang-jie/NettyGateway/blob/master/docs/netty-gateway-3.jpg)\n* 发送Tangjie到NettyGateway，关键字匹配不成功，路由到默认的http://10.46.158.10:8089/fcgi-bin/BSSP_SFC\n![](https://github.com/tang-jie/NettyGateway/blob/master/docs/netty-gateway-2.jpg)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftang-jie%2FNettyGateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftang-jie%2FNettyGateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftang-jie%2FNettyGateway/lists"}