search

Home  >  Q&A  >  body text

node.js - browsersync怎么用本地的tomcat服务器

本地用tomcat开了个服务器,所有项目都跑在上面。
现在想用gulp搭个环境,实现自动刷新,但是不起作用。


求问怎么解决啊

黄舟黄舟2876 days ago400

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-17 16:10:32

    You need to use the proxy parameter of Browsersync. proxy 参数。

    比如你 Tomcat 的地址是 127.0.0.1:8080,需要将这个地址代理,如:

    gulp.task('browser-sync', function() {
        browserSync.init({
            proxy: "127.0.0.1:8080"
        });
    });

    最后还是访问 Browsersync 的地址就可以了 127.0.0.1:3000

    For example, if your Tomcat address is 127.0.0.1:8080, you need to proxy this address, such as: 🎜 rrreee 🎜Finally, just visit the Browsersync address 127.0.0.1:3000🎜

    reply
    0
  • Cancelreply