{"id":17760612,"url":"https://github.com/mbasso/react-https-redirect","last_synced_at":"2025-03-15T09:31:43.909Z","repository":{"id":54175451,"uuid":"52720200","full_name":"mbasso/react-https-redirect","owner":"mbasso","description":"Force a redirect to HTTPS when not on a local web server","archived":false,"fork":false,"pushed_at":"2021-03-05T08:13:05.000Z","size":15,"stargazers_count":35,"open_issues_count":3,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-05T10:06:28.342Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/mbasso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-28T12:31:02.000Z","updated_at":"2025-01-09T20:20:34.000Z","dependencies_parsed_at":"2022-08-13T08:20:46.759Z","dependency_job_id":null,"html_url":"https://github.com/mbasso/react-https-redirect","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbasso%2Freact-https-redirect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbasso%2Freact-https-redirect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbasso%2Freact-https-redirect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbasso%2Freact-https-redirect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbasso","download_url":"https://codeload.github.com/mbasso/react-https-redirect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243203459,"owners_count":20253284,"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-10-26T19:06:31.546Z","updated_at":"2025-03-15T09:31:43.582Z","avatar_url":"https://github.com/mbasso.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React-https-redirect\n\n[![npm](https://img.shields.io/npm/v/react-https-redirect.svg)](https://www.npmjs.com/package/react-https-redirect)\n[![npm](https://img.shields.io/npm/l/react-https-redirect.svg)](https://github.com/mbasso/react-https-redirect/blob/master/LICENSE.md)\n\n---\n\n**⚠️ Security note ⚠️ - This element provides a client-side option when HSTS and server-enforced redirects aren't possible. Please don’t use this if you can configure the server.**\n---\n\n---\n\nThis is a React component equivalent of Polymer [platinum-https-redirect](https://elements.polymer-project.org/elements/platinum-https-redirect)\n\n\u003e The element redirects the current page to HTTPS, unless the page is loaded from a web server running on localhost.\n\u003e Using HTTP Strict Transport Security (HSTS) can be used to enforce HTTPS for an entire origin, following the first visit to any page on the origin. Configuring the underlying web server to redirect all HTTP requests to their HTTPS equivalents takes care of enforcing HTTPS on the initial visit as well. Both options provide a more robust approach to enforcing HTTPS, but require access to the underlying web server's configuration in order to implement.\n\u003e This element provides a client-side option when HSTS and server-enforced redirects aren't possible, such as when deploying code on a shared-hosting provider like GitHub Pages.\n\nYou can read more information [here](https://elements.polymer-project.org/elements/platinum-https-redirect).\n\n## Installation\n\nUsing [npm](https://www.npmjs.com/package/react-https-redirect):\n\n```bash\nnpm install --save react-https-redirect\n```\n\nSupposing a CommonJS environment, you can simply use the component in this way:\n\n```javascript\nimport HttpsRedirect from 'react-https-redirect';\n\n// you can just wrap your entire app to redirect it to the equivalent https version\n// for example:\n// http://example.com/    =\u003e    https://example.com/\n\n// you can also use a \"disabled\" prop to dinamically disable it\n// \u003cHttpsRedirect disabled={...}\u003e\n\nclass HttpsApp extends React.Component {\n\n  render() {\n    return (\n      \u003cHttpsRedirect\u003e\n        \u003cApp /\u003e\n      \u003c/HttpsRedirect\u003e\n    );\n  }\n}\n```\n\n\n## Author\n**Matteo Basso**\n- [github/mbasso](https://github.com/mbasso)\n- [@Teo_Basso](https://twitter.com/Teo_Basso)\n\n## Copyright and License\nCopyright (c) 2016, Matteo Basso.\n\nReact-https-redirect source code is licensed under the [MIT License](https://github.com/mbasso/react-https-redirect/blob/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbasso%2Freact-https-redirect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbasso%2Freact-https-redirect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbasso%2Freact-https-redirect/lists"}