{"id":19143012,"url":"https://github.com/globalradio/squid-redirect","last_synced_at":"2025-05-07T00:13:09.031Z","repository":{"id":83904689,"uuid":"117847582","full_name":"GlobalRadio/squid-redirect","owner":"GlobalRadio","description":"Configurable squid url redirector (python3)","archived":false,"fork":false,"pushed_at":"2023-07-25T06:04:26.000Z","size":8,"stargazers_count":2,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-19T16:11:54.556Z","etag":null,"topics":["python3","redirect","rewrite-urls","squid-proxy"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":false,"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/GlobalRadio.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":"2018-01-17T14:29:56.000Z","updated_at":"2023-08-08T16:09:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"99158387-240b-4def-ad4a-ce83ca2bbdbe","html_url":"https://github.com/GlobalRadio/squid-redirect","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/GlobalRadio%2Fsquid-redirect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GlobalRadio%2Fsquid-redirect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GlobalRadio%2Fsquid-redirect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GlobalRadio%2Fsquid-redirect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GlobalRadio","download_url":"https://codeload.github.com/GlobalRadio/squid-redirect/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252788532,"owners_count":21804284,"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":["python3","redirect","rewrite-urls","squid-proxy"],"created_at":"2024-11-09T07:29:17.163Z","updated_at":"2025-05-07T00:13:09.003Z","avatar_url":"https://github.com/GlobalRadio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"squid-redirect\n==============\n\nA `json` configurable `squid`(3.5) `url_rewrite_program` written in `python3`.\n\nUsecase: We wanted to transparently point our ios simulators at different content servers without modifying the ios application under test. Each test run on our ci-servers can transparently alias different endpoints.\n\n\nExamples\n--------\n\n### 1.) Trial the `url_rewrite_program` flow in a terminal\n\n```bash\n    python3 squid-redirect.py --rewrite '{\"www\\.capitalfm\\.com\": \"www.capitalfm.development.int.thisisglobal.com\"}'\n    0 http://www.capitalfm.com/_build/ -\n    0 OK rewrite-url=\"http://www.capitalfm.development.int.thisisglobal.com/_build/\"\n```\n\n### 2.) Startup an example `squid` server using our `url_rewrite_program`\n\n```bash\n    cat \u003c\u003cEOF \u003e rules.json\n    {\n        \"www\\\\\\\\.capitalfm\\\\\\\\.com\": \"www.capitalfm.development.int.thisisglobal.com\"\n    }\n    EOF\n\n    SQUID_CONF_SOURCE=/usr/local/etc/squid.conf\n    SQUID_CONF=./squid.conf\n    cp ${SQUID_CONF_SOURCE} ${SQUID_CONF}\n\n    cat \u003c\u003cEOF \u003e\u003e ${SQUID_CONF}\n\n    url_rewrite_children 3 startup=0 idle=1 concurrency=1\n    url_rewrite_extras \"\"\n    url_rewrite_program /usr/local/bin/python3 $(pwd)/squid-redirect.py --rewrite $(pwd)/rules.json\n    EOF\n\n    squid -N -f ${SQUID_CONF}\n```\n\n### 3.) Setup `osx` transparent `webproxy`.\n\nPrograms that respect `webproxy`:\n* `chrome`\n* `ios_simulator`\n\n`webproxy` is not sufficient for system-level programs like:\n* `firefox`\n* `curl`\n\n```bash\n    NETWORK_DEVICE=\"Wi-Fi\"\n    PROXY_HOST=\"localhost\"\n    PROXY_PORT=\"3128\"\n    networksetup -setwebproxy ${NETWORK_DEVICE} ${PROXY_HOST} ${PROXY_PORT}\n    networksetup -setsecurewebproxy ${NETWORK_DEVICE} ${PROXY_HOST} ${PROXY_PORT}\n\n    networksetup -setwebproxy ${NETWORK_DEVICE} \"\" \"\"\n    networksetup -setsecurewebproxy ${NETWORK_DEVICE} \"\" \"\"\n    networksetup -setwebproxystate ${NETWORK_DEVICE} off\n    networksetup -setsecurewebproxystate ${NETWORK_DEVICE} off\n```\n\n\nReferences\n----------\n\n### Squid Documentation\n\n* https://wiki.squid-cache.org/Features/Redirectors\n* http://www.squid-cache.org/Doc/config/url_rewrite_program/\n* http://www.squid-cache.org/Doc/config/url_rewrite_children/\n* http://www.squid-cache.org/Doc/config/url_rewrite_extras/\n\n### Alternate Example Implementations of `url_rewrite_program`\n\n* https://www.mindchasers.com/dev/app-squid-redirect\n* https://gofedora.com/how-to-write-custom-redirector-rewritor-plugin-squid-python/\n* https://github.com/krllmnkv/rewrite-squid\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglobalradio%2Fsquid-redirect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglobalradio%2Fsquid-redirect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglobalradio%2Fsquid-redirect/lists"}