Created
October 30, 2020 08:22
-
-
Save CroMarmot/8bb5e919793ee9f602d0a72117fdd6b2 to your computer and use it in GitHub Desktop.
修改请求路径
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// prepare | |
// npm i express | |
const express = require('express') | |
const app = express() | |
const port = 3000 | |
app.all('*', (req, res) => { | |
console.log(req.originalUrl); | |
res.send(`Your req path:[${req.originalUrl}]`) | |
}) | |
app.listen(port,'0.0.0.0', () => { | |
console.log(`serve at 0.0.0.0:${port}`) | |
}) | |
/* | |
location ~ 正则 { | |
rewrite 替换前正则圆括号提取 替换后'$+数字'为提取内容 break; | |
# 校验 转换效果 | |
proxy_pass http://127.0.0.1:3000; | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment