How to use browsersync with an apache vhost on same port?

Viewed 436

I know there are a lot of similar questions on SO and GitHub about this but none are working in my case.

I need for a project to use gulp + browsersync with an apache vhost (created with MAMP PRO 5.5).

Gulp is working (it does all the tasks I need). Browsersync is set up but it opens my website on a different port that the one which is used by MAMP. I've tested with default Port and Mamp default port. Browsersync still opens the website with the correct url but not the correct port.

I understand that I can't use the same port but how can I set up Browsersync ?

Here is my gulp relevant part :

gulp.task('browser-sync', ['sass', 'scripts'], function () {
    browserSync.init({
        open: 'external',
        host: 'my-domain.dev',
        proxy: 'my-domain.dev',
        https: {
            key: "/Users/path-to-custom-certificate/my-domain.dev.key",
            cert: "/Users/path-to-custom-certificate/my-domain.dev.crt"
        },
        //port: 443, // If I try same port as MAMP, Browsersync increments this port ex 444
        browser: "google chrome"

    });
});

Mybe something can be configured in APACHE ?

1 Answers

I hesitated to delete my question but in case it could helps :

Finally, it appears that my Browsersync code is correct. When I run gulp, it opens the wrong url with the Browsersync default port :

https://my-domain.dev:3000

But when I open the correct url (my-domain.dev) set in apache, Browsersync is connected and reloads that page.

Related