logo
down
shadow

How to make BrowserSync work with an nginx proxy server?


How to make BrowserSync work with an nginx proxy server?

By : user2955119
Date : November 22 2020, 10:38 AM
will help you To get more control over how opening the page is done, use opn instead of browser sync's mechanism. Something like this (in JS - sorry, my Coffee Script is a bit rusty):
code :
browserSync({
    server: {
        // ...
    },
    open: false,
    port: 3001
}, function (err, bs) {
    // bs.options.url contains the original url, so
    // replace the port with the correct one:
    var url = bs.options.urls.local.replace(':3001', ':3002');
    require('opn')(url);
    console.log('Started browserSync on ' + url);
});
map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

server {
    # ...

    # BrowserSync websocket
    location /browser-sync/socket.io/ {
        proxy_pass http://localhost:3001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }
}


Share : facebook icon twitter icon
Can NGINX work as Webserver and Proxy Server At Same Time?

Can NGINX work as Webserver and Proxy Server At Same Time?


By : Vincent Angelo
Date : March 29 2020, 07:55 AM
I think the issue was by ths following ,
My question here is that can we acheive this from NGINX server ?
code :
server {
    listen 80;
    server_name www.example.com;
    location /{
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://servera.example.com:8080/app;
        client_max_body_size 10M;
    }
    location /login{
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://serverb.example.com:8080/login;
        client_max_body_size 10M;
    }
}
CORS with reverse proxy Nginx server and nodejs won't work

CORS with reverse proxy Nginx server and nodejs won't work


By : J.Wang
Date : March 29 2020, 07:55 AM
hope this fix your issue It was a mistake in my nodejs code I didnt know that I needed to include response.setHeader('Access-Control-Allow-Origin', '*');
Cant connect Browsersync with DDEV nginx server, because SSL Error

Cant connect Browsersync with DDEV nginx server, because SSL Error


By : iamtraviscd
Date : March 29 2020, 07:55 AM
it should still fix some issue The problem was bad ssl certificates file. It was necessary to use docker container certificate. Proxy option is not anymore required.
After setup ddev container, you need to copy docker certificate to some location:
code :
browserSync.init({https: {
 key: "/Users/username/tmp/master.key",
 cert: "/Users/username/tmp/master.crt"
}, open:false});
Have you managed to make your node nginx proxy setup on Heroku work?

Have you managed to make your node nginx proxy setup on Heroku work?


By : ChrisCahill17
Date : March 29 2020, 07:55 AM
will be helpful for those in need I have used a Node.js + NGINX setup on heroku for many projects. This way, you can have nginx handle serving static files, caching, proxying to other servers, and proxying to several node processes.
Use the multi-buildpack buildpack (https://github.com/ddollar/heroku-buildpack-multi).
Configuring Nginx to make Angular 2 quickstart work with Browsersync

Configuring Nginx to make Angular 2 quickstart work with Browsersync


By : Joshuashepard
Date : March 29 2020, 07:55 AM
To fix this issue I have spent some time trying to make Angular2 Quickstart reachable through port 80 with Browsersync working. Browsersync is the technology responsible for live refresh when your app code is modified. It creates a websocket connection with your browser on launch, detects the changes to the files located into the app directory and send the appropriate updates. , Working solution
The idea is to use proxy_pass for two streams:
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org