{"id":21291414,"url":"https://github.com/bgokden/go-http-redirector","last_synced_at":"2025-03-15T16:21:04.267Z","repository":{"id":150858961,"uuid":"190642692","full_name":"bgokden/go-http-redirector","owner":"bgokden","description":"an http redirection service written in go","archived":false,"fork":false,"pushed_at":"2020-05-25T20:02:19.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T06:15:49.780Z","etag":null,"topics":["go","golang","http","redirecting-urls","service"],"latest_commit_sha":null,"homepage":"","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/bgokden.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":"2019-06-06T20:05:39.000Z","updated_at":"2020-05-25T20:02:22.000Z","dependencies_parsed_at":"2023-04-08T20:11:10.368Z","dependency_job_id":null,"html_url":"https://github.com/bgokden/go-http-redirector","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/bgokden%2Fgo-http-redirector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgokden%2Fgo-http-redirector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgokden%2Fgo-http-redirector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgokden%2Fgo-http-redirector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bgokden","download_url":"https://codeload.github.com/bgokden/go-http-redirector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243754759,"owners_count":20342701,"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":["go","golang","http","redirecting-urls","service"],"created_at":"2024-11-21T13:22:52.097Z","updated_at":"2025-03-15T16:21:04.246Z","avatar_url":"https://github.com/bgokden.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-http-redirector\n\nA basic http service to redirect requests to the defined url.\nRequests can be redirected as temporary or permanent based on regex matching.\n\nEnvironment variables can be used for configuration:\n\n* REDIRECT_URL\n* TEMPORARY_REDIRECT_REGEX\n* PERMANENT_REDIRECT_REGEX\n\nREDIRECT_URL is mandatory. eg.: https://blog.berkgokden.com\n\nTEMPORARY_REDIRECT_REGEX is a regex string. Default value matches html, php, asp extensions.  \n\nPERMANENT_REDIRECT_REGEX is a regex string. Default value matches jpg, png, bmp, json, js extensions.\n\nDefault redirection behaviour is temporary redirection.\n\nRedirections done with 307, 308 codes to keep http method type.\n\n## Build docker image:\n\n```shell\ndocker build -t berkgokden/redirector .\n```\n\n## Run as docker image locally\n\n```shell\ndocker run -it -p 9090:9090 -p 9091:9091 -e REDIRECT_URL=\"https://blog.berkgokden.com\" berkgokden/redirector\n```\n\nRedirection service is running on port 9090\n\nHeath/Readiness service is running on port 9091\n\nThese ports are not configurable since it is intended to be run inside docker.\n\nHeath endpoint: /healthy  \nReadiness endpoint /ready\n\n\n## Check redirections with curl:\n\nPermanent redirect:\n\n```shell\n$ curl -i localhost:9090/img.jpg\nHTTP/1.1 308 Permanent Redirect\nContent-Type: text/html; charset=utf-8\nLocation: https://blog.berkgokden.com/img.jpg\nDate: Thu, 06 Jun 2019 23:31:17 GMT\nContent-Length: 71\n\n\u003ca href=\"https://blog.berkgokden.com/img.jpg\"\u003ePermanent Redirect\u003c/a\u003e.\n```\n\nTemporary redirect:\n\n```shell\n$ curl -i localhost:9090/page.html\nHTTP/1.1 307 Temporary Redirect\nContent-Type: text/html; charset=utf-8\nLocation: https://blog.berkgokden.com/page.html\nDate: Thu, 06 Jun 2019 23:32:20 GMT\nContent-Length: 73\n\n\u003ca href=\"https://blog.berkgokden.com/page.html\"\u003eTemporary Redirect\u003c/a\u003e.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgokden%2Fgo-http-redirector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbgokden%2Fgo-http-redirector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgokden%2Fgo-http-redirector/lists"}