{"id":20331174,"url":"https://github.com/comcast/restfulhttpsproxy","last_synced_at":"2025-04-11T21:07:33.801Z","repository":{"id":67619086,"uuid":"209846519","full_name":"Comcast/RestfulHttpsProxy","owner":"Comcast","description":null,"archived":false,"fork":false,"pushed_at":"2019-11-11T21:09:23.000Z","size":64,"stargazers_count":13,"open_issues_count":6,"forks_count":5,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-11T21:07:23.406Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/Comcast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-20T17:32:31.000Z","updated_at":"2022-11-28T00:34:38.000Z","dependencies_parsed_at":"2023-07-09T01:00:34.947Z","dependency_job_id":null,"html_url":"https://github.com/Comcast/RestfulHttpsProxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2FRestfulHttpsProxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2FRestfulHttpsProxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2FRestfulHttpsProxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2FRestfulHttpsProxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Comcast","download_url":"https://codeload.github.com/Comcast/RestfulHttpsProxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480434,"owners_count":21110937,"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":[],"created_at":"2024-11-14T20:19:03.818Z","updated_at":"2025-04-11T21:07:33.779Z","avatar_url":"https://github.com/Comcast.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RestfulHttpsProxy\nProxy server that can have its rewrite rules configured through a REST API\n\n# License\nThis project is licensed under\n[LICENSE](LICENSE)\n\n# Contributing\nPlease read [CONTRIBUTING](CONTRIBUTING.md).\n\nPlease read the [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md). We take it very seriously!\n\n# Getting started\nA version of golang is needed that supports go modules by default.\n\nRun `make` in project root. Project root must not be in the go src directory, otherwise go modules has to be enabled through environment variables.\nIf using for the first time the cert must be trusted. Enable the system\nto use this proxy in the settings and go to `http://a.proxi/ca.pem` on the\nmobile device to install the cert.\n\nFor long term use, use `make longTermDeploy`\n\nTo build a docker image use `make docker-image`\n\nTo run the docker image use `make docker-run`\n\nThere are some limitations when using docker, for example, the machine cannot proxy itsself.\n\n# API\n### To clear rewrite rules (example)\nRequest Method (Doesn't matter for now)\n```\nPOST\n```\nRequest URL\n```\nhttp://a.proxi/api/rules/set\n```\nRequest Body (JSON)\n```\n{\n\t\"ip\": \"127.0.0.1\"\n\t\"rules\":[]\n}\n```\n\n### To set rewrite rules (example)\nRequest Method  (Doesn't matter for now)\n```\nPOST\n```\nRequest URL\n```\nhttp://a.proxi/api/rules/set\n```\nRequest Body (JSON)\n```\n{\n    \"rules\": [\n        {\n            \"url\": \"google\\\\.com\",\n            \"uploadSpeed\": 16000000,\n            \"downloadSpeed\": 8000000,\n            \"responseDelay\": 10000,\n            \"rewrite\": {\n                \"request\": {\n                    \"url\": [\n                        {\n\t                        \"find\": \"(?i)google\",\n\t                        \"replace\": \"bing\"\n                        }\n                    ],\n                    \"header\": [\n                        {\n\t                        \"find\": \"(?i)\\\\nDate: .*\\\\n\",\n\t                        \"replace\": \"\\nDate: TODAY\\n\"\n                        }\n                    ],\n                    \"body\": [\n                        {\n\t                        \"find\": \"(?i)hello world\",\n\t                        \"replace\": \"restfulHttpsProxy\"\n                        }\n                    ]\n                },\n                \"response\": {\n\t                \"status\": [\n\t\t                {\n\t\t\t                \"replace\": \"418 I'm a teapot\"\n\t\t\t            }\n\t\t\t\t\t],\n                    \"header\": [\n                        {\n\t                        \"find\": \"(?i)\\\\nDate: .*\\\\n\",\n\t                        \"replace\": \"\\nDate: TODAY\\n\"\n                        }\n                    ],\n                    \"body\": [\n                    \t{\n\t                        \"find\": \"bing\",\n\t                        \"replace\": \"google\"\n                        },\n                        {\n\t                        \"find\": \"(?i)hello world\",\n\t                        \"replace\": \"(restfulHttpsProxy)\"\n                        }\n                    ]\n                }\n            }\n        }\n    ]\n}\n```\n- *This command will delete existing rules and use the new ones*\n- *The Regular expressions must be double escaped. so the regex `\\.` will be `\\\\.` to look for a dot.*\n\n### Supported Keys\n- root object without key\n   - **ip** Optional field, specifies the ip that the rules apply to.\n   - **rules** Array of proxy rules, can be empty to clear rules\n      - **url** Regex that will trigger the application of this rule if it is satisfied when compared to the url\n\t   - **uploadSpeed** Throttles the upload speed to this value if url pattern is satisfied (Rate is in bits/second)\n\t   - **downloadSpeed** Throttles the download speed to this value if url pattern is satisfied (Rate is in bits/second)\n\t   - **responseDelay** Kind of like ping, but what it actually does is it simulates a slow server that thinks for this amount of time before responding.\n\t - **rewrite**  All of the rewrite rules that modify traffic go here.\n\t\t - **request**\n\t\t\t - **url** Array of url rule objects\n\t\t\t\t - see rule objects below\n\t\t\t - **headers** Array of header rule objects\n\t\t\t\t - see rule objects below\n\t\t\t - **body** Array of body rule objects\n\t\t\t\t - see rule objects below\n\t\t - **response**\n\t\t\t - **status** Array of status rule objects\n\t\t\t\t - see rule objects below\n\t\t\t - **headers** Array of header rule objects\n\t\t\t\t - see rule objects below\n\t\t\t - **body** Array of body rule objects\n\t\t\t\t - **find** Can only be used with replace (Regex pattern to find)\n\t\t\t\t - **replace**  Replaces what is found by find, otherwise will just replace the whole thing. Cannot be used with anything except for **find**\n\t\t\t\t - **delete** Deletes every instance of the matched regex pattern, cannot be used with any other key.\n\t\t\t\t - **append** Adds this to the end of the data. Cannot be used together with any other key.\n\t\t\t\t - **prepend** Adds this to the beginning of the data. Cannot be used together with any other key.\n\n- *The regular expressions must be double escaped. so the regex `\\.` will be `\\\\.` to look for a dot.*\n- *The regular expressions are in golang regex format.*\n- *if you want to use (**find**  + **replace**)  (**delete**)  (**append**)  (**prepend**) together, then you must separate them into separate rules*\n\nSee the api-example...md files for more info.\n\n### Logging is not yet supported\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomcast%2Frestfulhttpsproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomcast%2Frestfulhttpsproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomcast%2Frestfulhttpsproxy/lists"}