BrowserSync / browser-sync

Keep multiple browsers & devices in sync when building websites. https://browsersync.io
https://discord.gg/2d2xUThp
Apache License 2.0
12.18k stars 757 forks source link

BrowserSync willnot follow links to pages with "php" extension; prompts to download; proxy server #1131

Open paxperscientiam opened 8 years ago

paxperscientiam commented 8 years ago

Issue details

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.

Steps to reproduce/test case

Run the script node live.js (see below). Once site has loaded in browser, click link.

Please specify which version of Browsersync, node and npm you're running

{cli command here}

for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync

/**
 * 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"]
});
yanwsh commented 8 years ago

Hello, looks like you are using browser sync in proxy mode, does php work on localhost:8081?

phauer commented 7 years ago

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:

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.

stefanomonteiro commented 6 years ago

Any resolution for this case? I am having the same issue two years later.

rosalynpoort commented 5 years ago

same issue with downloading php files. @stefanomonteiro did you find a resolution?