Prepend `https://` to humanized URLs like `sindresorhus.com` and `localhost`
JavaScript
66
35 commits
updated Sep 18, 2026
Prepend
https://to humanized URLs likesindresorhus.comandlocalhost
npm install prepend-http
import prependHttp from 'prepend-http';
prependHttp('sindresorhus.com');
//=> 'https://sindresorhus.com'
prependHttp('localhost', {https: false});
//=> 'http://localhost'
prependHttp('https://sindresorhus.com');
//=> 'https://sindresorhus.com'
Type: string
The URL to prepend https:// to.
Type: object
Type: boolean
Default: true
Prepend https:// instead of http://.
URLs with authentication information (e.g., login:password@site.com) are returned unchanged as basic auth in URLs is deprecated and to avoid conflicting with custom schemes.
Overall
Maintained
Code review
npm
Latest release
Releases this year
Prepend `https://` to humanized URLs like `sindresorhus.com` and `localhost`
JavaScript
66
35 commits
updated Sep 18, 2026
Prepend
https://to humanized URLs likesindresorhus.comandlocalhost
npm install prepend-http
import prependHttp from 'prepend-http';
prependHttp('sindresorhus.com');
//=> 'https://sindresorhus.com'
prependHttp('localhost', {https: false});
//=> 'http://localhost'
prependHttp('https://sindresorhus.com');
//=> 'https://sindresorhus.com'
Type: string
The URL to prepend https:// to.
Type: object
Type: boolean
Default: true
Prepend https:// instead of http://.
URLs with authentication information (e.g., login:password@site.com) are returned unchanged as basic auth in URLs is deprecated and to avoid conflicting with custom schemes.
Overall
Maintained
Code review
npm
Latest release
Releases this year