I am running BrowserSync as a proxy server for local web servers.
Attempting to follow a link to a webpage with a ".php" extension causes a download modal dialog.
Run the script node live.js (see below).
Once site has loaded in browser, click link.
Npm [ 2.15.3 ]
[ ] linux
[ ] other _(please specify which)_
[x ] API
{cli command here}
/**
* Require Browsersync
*/
var requireg = require('requireg');
var bs = requireg('browser-sync').create();
/**
* Run Browsersync with server config
*/
bs.init({
proxy: "localhost:8081",
reloadOnRestart: false,
online: false,
serveStatic: ["../wwwroot"],
files: ["../wwwroot"]
});
Hello, looks like you are using browser sync in proxy mode, does php work on localhost:8081?
Same here. I'm using browser-sync 2.18.13, npm 5.1.0 and node 8.0.0. I'm using the CLI:
browser-sync start --proxy 'https://localhost' --serveStatic 'src' --files 'src'
The reason for the download window is the wrong content-type returned by browser-sync's proxy:
Content-Type: text/html; charset=UTF-8 when requesting a .php file.Content-Type: application/octet-stream which causes the browser to open the download window.I would assume that the proxy just passes the content-type on.
By the way: the other HTTP headers are also not correctly returned by the proxy.
Any resolution for this case? I am having the same issue two years later.
same issue with downloading php files. @stefanomonteiro did you find a resolution?
Most helpful comment
same issue with downloading php files. @stefanomonteiro did you find a resolution?