Vagrant VM中的Browsersync无法正常代理

时间:2015-09-05 16:51:54

标签: node.js apache2 vagrant gulp browser-sync

我遇到浏览器同步无法正确代理我的apache2服务器的问题。我在主机上使用Ubuntu 15.04的Ubuntu 14.04虚拟机中运行浏览器同步。我使用以下配置:

browserSync({
    proxy: 'localhost:80',
    port: '8081',
    open: false
});

客户机的端口80映射到主机上的8080。 gulp任务运行没有问题,我得到浏览器同步的预期输出。如果我访问localhost:8081 / index.php,它没有任何问题。但是,如果我尝试访问localhost:8081 / foo / index.php,我的浏览器将重定向到localhost:8080 / foo / index.php,并且浏览器同步不起作用。

如果我将logLevel设置为debug,我在访问localhost时会看到输出:8081 / index.php:

[BS]浏览器已连接:Chrome,版本:45.0.2454.85

但是,当我访问localhost时没有输出:8081 / foo / index.php

在VM中使用浏览器同步时是否存在错误?

0 个答案:

没有答案