浏览器同步代理中间件
Browser-Sync Proxy Middleware
我有一个关于代理中间件的问题
我这样初始化浏览器同步:
gulp.task('browser-sync', function() {
files = [
'**/*.php'
];
browserSync.init(files,{
open:false,
port: 3000,
ui: {
port: 3000 + 1
},
proxy: {
baseDir: "./",
target : "http://example.com",
}
});
});
我使用 nginx 代理 http://127.0.0.1:3000
server {
listen EXTERNAL_IP:80;
server_name development.example.com;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
但是浏览器同步调用 127.0.0.1:3000 而不是 http://development.example.com
我如何告诉 browser-sync 它应该调用 http://development.example.com ?
谢谢!
server {
listen EXTERNAL_IP:80;
server_name development.example.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:3000;
}
}
原来是nginx的东西:)
我有一个关于代理中间件的问题
我这样初始化浏览器同步:
gulp.task('browser-sync', function() {
files = [
'**/*.php'
];
browserSync.init(files,{
open:false,
port: 3000,
ui: {
port: 3000 + 1
},
proxy: {
baseDir: "./",
target : "http://example.com",
}
});
});
我使用 nginx 代理 http://127.0.0.1:3000
server {
listen EXTERNAL_IP:80;
server_name development.example.com;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
但是浏览器同步调用 127.0.0.1:3000 而不是 http://development.example.com 我如何告诉 browser-sync 它应该调用 http://development.example.com ? 谢谢!
server {
listen EXTERNAL_IP:80;
server_name development.example.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:3000;
}
}
原来是nginx的东西:)