ngrok

https://ngrok.com/download

使用

进入ngrok的exe文件所在的目录,使用“ngrok http [port]”启动端口映射。本地django项目默认使用8000端口,所以输入如下命令即可

  1. ngrok http 8000

image.png

解决方案

问题:错误 Invalid Host header
原因:vue cli3 。新版的webpack-dev-server 出于安全考虑,默认检查 hostname,如果hostname不是配置内的,将中断访问。
解决:在配置文件中新增配置

  1. //vue.config.js
  2. module.exports = {
  3. devServer: {
  4. disableHostCheck: true
  5. },
  6. };

其他版本解决
webpack.dev.conf.js添加配置 disableHostCheck: true,

  1. devServer: {
  2. clientLogLevel: 'warning',
  3. historyApiFallback: {
  4. rewrites: [
  5. { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
  6. ],
  7. },
  8. hot: true,
  9. contentBase: false, // since we use CopyWebpackPlugin.
  10. compress: true,
  11. host: HOST || config.dev.host,
  12. port: PORT || config.dev.port,
  13. open: config.dev.autoOpenBrowser,
  14. overlay: config.dev.errorOverlay
  15. ? { warnings: false, errors: true }
  16. : false,
  17. publicPath: config.dev.assetsPublicPath,
  18. proxy: config.dev.proxyTable,
  19. quiet: true, // necessary for FriendlyErrorsPlugin
  20. watchOptions: {
  21. poll: config.dev.poll,
  22. },
  23. disableHostCheck: true, //新增
  24. },

在服务器上部署使用

https://zhuanlan.zhihu.com/p/49192702

钉钉内网穿透

文档
https://developers.dingtalk.com/document/resourcedownload/http-intranet-penetration

使用

1.下载工具

  1. git clone https://github.com/open-dingtalk/pierced.git

2.启动
windows 执行以下命令

  1. cd windows_64
  2. ding -config=ding.cfg -subdomain=abcde 8080
  1. 参数说明: | 参数 | 说明 | | —- | —- | | -config | 内网穿透的配置文件,按照命令示例固定为钉钉提供的./ding.cfg,无需修改 | | -subdomain | 您需要使用的域名前缀,该前缀将会匹配到“vaiwan.com”前面,例如你的subdomain是abcde,启动工具后会将abcde.vaiwan.com映射到本地。 | | 端口 | 您需要代理的本地服务http-server端口,例如你本地端口为8080等 |

启动完客户端后,你访问http://abcde.vaiwan.com/xxxxx都会映射到 http://127.0.0.1:8080/xxxxx。

**注意

备注:不要使用常用的字符。可能会被占用

https://segmentfault.com/a/1190000038658138

https://github.com/fatedier/frp/blob/dev/README_zh.md

钉钉
https://developers.dingtalk.com/document/resourcedownload/http-intranet-penetration

ngrok
https://ngrok.com/download

https://segmentfault.com/a/1190000018990329

frp相关
https://juejin.cn/post/6844904191681380360

123.207.97.144


http://pc.wykl.top:8080/
http://seller.wykl.top:8080/