Browsers in Vagrant VM are not correct proxies

I had a problem when browser synchronization proxies the apache2 server incorrectly. I am running browser synchronization via gulp on an Ubuntu 14.04 VM with Ubuntu 15.04 on the host. I am using the following configuration:

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

Port 80 of the guest machine maps to 8080 on the host. The gulp task runs without problems, and I get the expected result from browser synchronization. If I visit localhost: 8081 / index.php, it works without any problems. If I try to visit localhost: 8081 / foo / index.php, my browser redirects to localhost: 8080 / foo / index.php, and browser synchronization does not work.

If I set logLevel for debugging, I see the output when I visit localhost: 8081 / index.php:

[BS] Browser connected: Chrome, version: 45.0.2454.85

There is no result, however, when I visit localhost: 8081 / foo / index.php

Is there an error while synchronizing the browser when used in a virtual machine?

+4
source share

Source: https://habr.com/ru/post/1606079/


All Articles