Description
Hi, i set proxy
in Webpack-dev-server as below
devServer: {
port: METADATA.port,
host: METADATA.host,
proxy: {
"/service_detail/*": {
target:"http://localhost:3004",
secure: false
}
}
}
My app is running on http://localhost:3000/ (Webpack-dev-server)
when i click some button on my app UI
The AJAX GET ( http://localhost:3000/service_detail ) will be fired
and Webpack-dev-server will proxy that url to json-server
that's, the process of that AJAX GET like below
(From my app)
http://localhost:3000/service_detail
|
V
Webpack-dev-server
|
V
(To json-server)
http://localhost:3004/service_detail
everything is working as expected
then i integrate the browser-sync-webpack-plugin ...
new BrowserSyncPlugin(
// BrowserSync options
{
host: 'localhost',
port: 3002,
proxy: 'http://localhost:3000',
},
// plugin options
{
reload: true
}
)
so now i can see my app running on http://localhost:3002/ (BrowserSync)
and i can see that in my mobile by typing <my ip>:3002
in url address bar
looks great !!!
BUT
If now i click that button (no matter where i do that in my mobile or pc)
I find out the app cant fetch the result from json-server in my mobile !!!
but in my pc, it still works expected
WHY ?
Is it a bug or i miss some concept of it ?