我有一个关于代理中间件的问题。
我像这样初始化Browser-Sync:
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,我如何告诉浏览器同步它应该调用http://development.example.com?谢谢!
发布于 2016-04-06 09:55:15
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的事情:)
https://stackoverflow.com/questions/36447384
复制相似问题