{"id":16859748,"url":"https://github.com/dotcypress/koa-force-ssl","last_synced_at":"2025-03-22T06:31:29.285Z","repository":{"id":17258162,"uuid":"20027685","full_name":"dotcypress/koa-force-ssl","owner":"dotcypress","description":"Koa.js middleware for force SSL","archived":false,"fork":false,"pushed_at":"2018-08-28T21:45:32.000Z","size":8,"stargazers_count":31,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T09:03:20.211Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/dotcypress.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}},"created_at":"2014-05-21T16:03:29.000Z","updated_at":"2021-11-04T03:48:27.000Z","dependencies_parsed_at":"2022-07-26T14:32:11.933Z","dependency_job_id":null,"html_url":"https://github.com/dotcypress/koa-force-ssl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcypress%2Fkoa-force-ssl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcypress%2Fkoa-force-ssl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcypress%2Fkoa-force-ssl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcypress%2Fkoa-force-ssl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotcypress","download_url":"https://codeload.github.com/dotcypress/koa-force-ssl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244918500,"owners_count":20531682,"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-13T14:19:38.271Z","updated_at":"2025-03-22T06:31:27.547Z","avatar_url":"https://github.com/dotcypress.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koa-force-ssl\n\n\u003ca href=\"https://communityinviter.com/apps/koa-js/koajs\" rel=\"KoaJs Slack Community\"\u003e![KoaJs Slack](https://img.shields.io/badge/Koa.Js-Slack%20Channel-Slack.svg?longCache=true\u0026style=for-the-badge)\u003c/a\u003e\n\n[Koa.js](http://koajs.com/) middleware for force SSL\n\n*This middleware is deprecated, please use [koa-sslify](https://github.com/turboMaCk/koa-sslify)*\n\n\n\n## Install \n```\n$ npm install koa-force-ssl\n```\n\n## API\n`forceSSL(port, hostname, temporary);`\n\n* port - SSL port (default value: 443)\n* hostname - host name for redirect (by default will redirect to same host)\n* temporary - use \"302 Temporary Redirect\" (by default will use \"301 Permanent Redirect\")\n\n## Example\n```\nvar koa = require('koa');\nvar http = require('http');\nvar https = require('https');\nvar fs = require('fs');\nvar forceSSL = require('koa-force-ssl');\n\nvar app = koa();\n\n// Force SSL on all page\napp.use(forceSSL());\n\n// index page\napp.use(function * (next) {\n  this.body = \"hello world from \" + this.request.url;\n});\n\n// SSL options\nvar options = {\n  key: fs.readFileSync('server.key'),\n  cert: fs.readFileSync('server.crt')\n}\n\n// start the server\nhttp.createServer(app.callback()).listen(80);\nhttps.createServer(options, app.callback()).listen(443);\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotcypress%2Fkoa-force-ssl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotcypress%2Fkoa-force-ssl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotcypress%2Fkoa-force-ssl/lists"}