{"id":16631014,"url":"https://github.com/goetas/docker-nginx-redirect","last_synced_at":"2026-04-29T14:32:50.053Z","repository":{"id":148245376,"uuid":"153927764","full_name":"goetas/docker-nginx-redirect","owner":"goetas","description":"Handle HTTP redirects with this simple docker image","archived":false,"fork":false,"pushed_at":"2018-10-20T18:13:29.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T06:11:58.415Z","etag":null,"topics":["docker","http","nginx","nginx-proxy","redirect"],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","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/goetas.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-10-20T16:56:14.000Z","updated_at":"2019-01-12T20:15:46.000Z","dependencies_parsed_at":"2023-05-19T13:00:22.433Z","dependency_job_id":null,"html_url":"https://github.com/goetas/docker-nginx-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/goetas%2Fdocker-nginx-redirect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goetas%2Fdocker-nginx-redirect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goetas%2Fdocker-nginx-redirect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goetas%2Fdocker-nginx-redirect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goetas","download_url":"https://codeload.github.com/goetas/docker-nginx-redirect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243093026,"owners_count":20235281,"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":["docker","http","nginx","nginx-proxy","redirect"],"created_at":"2024-10-12T04:50:32.296Z","updated_at":"2026-04-29T14:32:50.016Z","avatar_url":"https://github.com/goetas.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nginx redirect\n\nThis is a very simple nginx docker image that helps you redirecting HTTP requests to the `www` sub-domain.\n\n**Rationale:**\u003cbr\u003e\nIt is a common use case to have a project on a hypothetical `www.example.com`. \nWhat about requests going to  `example.com`?\u003cbr\u003e\nOf course you can configure your project to redirect requests to the `www` sub-domain...\u003cbr\u003e \nWhat is this should happen only for the \"production/live\" environment and for \"staging\"? \n(as most likely is going to look something as `www-staging.example.com`).\u003cbr\u003e\nOn staging having `staging.example.com` to redirect to `www-staging.example.com` could make no sense and will \nrequire a different rule.\n\nRedirecting to `www` is not responsibility of \"your\" application and can be done outside of it. \nHere it comes useful `goetas/nginx-redirect`. \n\n\n## Usage\n\nBasic example, using a docker-compose file:\n\n```yaml\nservices:\n    www_redirector:\n      image: goetas/nginx-redirect:latest\n```\n\nAn more sophisticated use case is when used in combination with [jwilder/nginx-proxy](https://github.com/jwilder/nginx-proxy):\n\n```yaml\nservices:\n    web:\n      image: jwilder/nginx-proxy\n      ports:\n        - \"80:80\"\n  \n    myproject:\n      image: myproject\n      environment:\n        VIRTUAL_HOST: www.example.com\n         \n    www_redirector:\n      image: goetas/nginx-redirect:latest\n      environment:\n        VIRTUAL_HOST: example.com\n```\n\nIn this example:\n- `web`: is listening on the port 80 (is the only container exposed to the outside)\n- `myproject`: is the image that holds the code for your project, \n   and does not need to be aware which is going to be the hostname where the \"project\" will be exposed.\n   \u003cbr\u003e_The proxy will forward to it requests that are directed to `www.example.com` (thanks to `VIRTUAL_HOST=www.example.com`)_\n- `www_redirector`: redirects eventual requests from `http://example.com` to `http://www.example.com`\n   \u003cbr\u003e_The proxy will forward to it requests that are directed to `example.com` (thanks to `VIRTUAL_HOST=example.com`)_\n   \n   \n## Configuration variables\n\nUsing environment variables is possible to customize the redirect-behaviour.\nAll the configurations are optional.\n\n- `REDIRECT_CODE`: HTTP redirect code (the default is 301)\n- `REDIRECT_SUBDOMAIN`: to which sub-domain redirect (the default is to prepend `www.` to the original hostname)\n\n## Other info\n\nThe project supports properly HTTPS redirects and respects the `X-Forwarded-Proto` and `X-Forwarded-Port` headers.\n\nThis image is based on the latest nginx docker image.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoetas%2Fdocker-nginx-redirect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoetas%2Fdocker-nginx-redirect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoetas%2Fdocker-nginx-redirect/lists"}