From f30f2de878ae34bd8a46e268fda694902e80476a Mon Sep 17 00:00:00 2001 From: MICHAEL JACKSON Date: Sun, 26 Mar 2017 00:13:51 -0700 Subject: [PATCH] Allow requests to hit the backend in dev --- scripts/start.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/start.js b/scripts/start.js index dae81c4..1f0b851 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -158,21 +158,21 @@ function addMiddleware(devServer) { // `proxy` lets you to specify a fallback server during development. // Every unrecognized request will be forwarded to it. var proxy = require(paths.appPackageJson).proxy; - devServer.use(historyApiFallback({ - // Paths with dots should still use the history fallback. - // See https://github.com/facebookincubator/create-react-app/issues/387. - disableDotRule: true, - // For single page apps, we generally want to fallback to /index.html. - // However we also want to respect `proxy` for API calls. - // So if `proxy` is specified, we need to decide which fallback to use. - // We use a heuristic: if request `accept`s text/html, we pick /index.html. - // Modern browsers include text/html into `accept` header when navigating. - // However API calls like `fetch()` won’t generally accept text/html. - // If this heuristic doesn’t work well for you, don’t use `proxy`. - htmlAcceptHeaders: proxy ? - ['text/html'] : - ['text/html', '*/*'] - })); + //devServer.use(historyApiFallback({ + // // Paths with dots should still use the history fallback. + // // See https://github.com/facebookincubator/create-react-app/issues/387. + // disableDotRule: true, + // // For single page apps, we generally want to fallback to /index.html. + // // However we also want to respect `proxy` for API calls. + // // So if `proxy` is specified, we need to decide which fallback to use. + // // We use a heuristic: if request `accept`s text/html, we pick /index.html. + // // Modern browsers include text/html into `accept` header when navigating. + // // However API calls like `fetch()` won’t generally accept text/html. + // // If this heuristic doesn’t work well for you, don’t use `proxy`. + // htmlAcceptHeaders: proxy ? + // ['text/html'] : + // ['text/html', '*/*'] + //})); if (proxy) { if (typeof proxy !== 'string') { console.log(chalk.red('When specified, "proxy" in package.json must be a string.'));