BrowserSync / browser-sync

Keep multiple browsers & devices in sync when building websites. https://browsersync.io
https://discord.gg/2d2xUThp
Apache License 2.0
12.17k stars 754 forks source link

BrowserSync with Virtual Host doesn't work. #1730

Open yurenlimbu opened 4 years ago

yurenlimbu commented 4 years ago

How to setup BrowserSync with Virtual Host?

Here is my setup gulp file:

export const serve = (done) => {
    server.init({
        host: 'dev.example.loc',
        proxy: "http://dev.example.loc",
        open: 'external',
    });
    done();
}

In terminal

Finished 'scripts' after 456 ms
[Starting 'serve'...
Finished 'serve' after 9.61 ms
Starting 'watch'...
[Browsersync] Proxying: http://dev.example.loc
[Browsersync] Access URLs:
Local: http://localhost:3002
External: http://192.168.0.236:3002
UI: http://localhost:3003
UI External: http://localhost:3003

Opening URL: http://dev.example.loc:3002/

I want to load without a port number. Like http://dev.example.loc

pipja commented 4 years ago

I think if you want it to go without the port number, change the option's port number to 80

yurenlimbu commented 4 years ago

@pipja Thanks for your reply. I tried as your suggestion but not working.

pipja commented 4 years ago

in settings file:

module.exports = {
    "ui": {
        "port": 3001
    },
    "files": false,
    "watchEvents": [
        "change"
    ],
    "watch": false,
    "ignore": [],
    "single": false,
    "watchOptions": {
        "ignoreInitial": true
    },
    "server": true,
    "proxy": false,
    "port": 80,
    "https": true,
    "middleware": false,
    . . .
}

command line: browser-sync start --config bs-config.js

I can see that the server is started at port 81 instead of 80, but I also have IIS using port 80 so it might be a setup problem on my end...