文件操作 - README.md
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/is-https/README.md
编辑文件内容
# is-https > Check if the given request is HTTPS [](https://npmjs.com/package/is-https) [](https://npmjs.com/package/is-https) ## Usage Install package: ```bash yarn add is-https # or npm install is-https ``` ```js const isHTTPS = require('is-https') // or import isHTTPS from 'is-https' ``` ```ts function isHTTPS(req: IncomingMessage, trustProxy: Boolean = true): Boolean | undefined ``` ## Behaviour `isHTTPS` function tries to use 2 different methods for HTTPS detection: - Test if `x-forwarded-proto` header contains `https` - Can be disabled by setting `trustProxy` argument to `false` - Test if `req.connection.encrypted` is `true` Returns either `true` or `false` based on checks or `undefined` if no check was reliable. **TIP:** If you want to redirect users from `http` to `https`, it is better using `isHTTPS(req) === false` to avoid redirect loops. ## Related - [redirect-ssl](https://www.npmjs.com/package/redirect-ssl) - Connect middleware to enforce HTTPS ## License MIT
修改文件时间
将文件时间修改为当前时间的前一年
删除文件