{"id":26647134,"url":"https://github.com/codomatech/goprep","last_synced_at":"2025-04-11T02:33:22.372Z","repository":{"id":217083399,"uuid":"742864829","full_name":"codomatech/goprep","owner":"codomatech","description":"Programmable REverse Proxy in Go. Modify responses in a Python-like language.","archived":false,"fork":false,"pushed_at":"2024-01-28T22:28:30.000Z","size":16,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T23:51:32.111Z","etag":null,"topics":["reverse-proxy","starlark"],"latest_commit_sha":null,"homepage":"","language":"Go","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/codomatech.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-13T15:48:37.000Z","updated_at":"2025-01-29T02:53:41.000Z","dependencies_parsed_at":"2025-03-24T23:51:07.009Z","dependency_job_id":"b2565c9e-712f-40e0-929c-c9b7f8d50339","html_url":"https://github.com/codomatech/goprep","commit_stats":null,"previous_names":["codomatech/goprep"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codomatech%2Fgoprep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codomatech%2Fgoprep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codomatech%2Fgoprep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codomatech%2Fgoprep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codomatech","download_url":"https://codeload.github.com/codomatech/goprep/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248329809,"owners_count":21085607,"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":["reverse-proxy","starlark"],"created_at":"2025-03-24T23:51:04.909Z","updated_at":"2025-04-11T02:33:22.352Z","avatar_url":"https://github.com/codomatech.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `goprep` - Programmable REverse Proxy\n\nThis is a fast reverse proxy in Go which lets you modify the response in a Python-like\nlanguage called [Starlark](https://github.com/bazelbuild/starlark/blob/master/spec.md).\n## Use Case\n\nWherever you think to yourself:\n\n\u003e this existing API/service is amazing, if only it had feature x it would be perfect\n\nThis is where `goprep` is your friend. Just place `goprep` in front of your dream API and\nwrite a script to modify the response to your liking.\n\nWe include an [example](examples/cors-allow-cookies/scripts/cors-cookies.star) which sets the\nresponse header properly to make the proxied service accessible across domains.\n\n\n## Usage\n\n`goprep` is meant to be used within Docker. The simplest way to run it is somehing like:\n\n```bash\ndocker run \\\n    -p 6350:6350\\\n    -e SOURCE_URL=https://httpbin.org/\\\n    -v $PWD/examples/cors-allow-cookies/scripts/:/etc/goprep/scripts\\\n    codomatech/goprep\n```\n\nIt can be used with Compose or your favourite docker orchestration environment in a similar manner.\n\n### Environment Variables\n\n- `SOURCE_URL`: *required*. The full URL of the API/service which sits behind `goprep`.\n- `PORT`: *optional*. Default=`6350`. The port which `goprep` will listen on.\n- `SCRIPTS_DIR`: *optional*. Default=`'/etc/goprep/scripts'`. The directory where your scripts are located.\n\n### Proxy Scripts\n\nA proxy script is a script in [Starlark](https://github.com/bazelbuild/starlark) which describes how the response\nshould be modified.\n\nThe main function in the script is named `modify` with the following signature:\n```python\n\ndef modify(req, resp):\n    # req is a dict of request parameters\n    # resp is a dict of response parameters\n    ...\n    # modify can return override values for headers and body, both are optional\n    return {\n        'headers': {},  # dict of header overrides\n        'body': ...,    # string of body replacement\n    }\n```\n\nPlease check the [examples directory](examples) for more insights.\n\n---\n`goprep` is a work of :heart: by [Codoma.tech](https://www.codoma.tech/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodomatech%2Fgoprep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodomatech%2Fgoprep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodomatech%2Fgoprep/lists"}