cli icon indicating copy to clipboard operation
cli copied to clipboard

Browser-sync http2 server returns "Could not proxy request."

Open hylmar opened this issue 3 years ago • 3 comments

Describe the bug

My local environment was running smoothly with netlify dev booting my custom framework, which simply started an http server using browser-sync. However, I wanted my local dev environment to use http2, so I updated my setup accordingly. Now when I start my server through netlify dev, my custom framework is serving everything well with http2 at port 8000, but the netlify layer at port 9000 returns "Could not proxy request."

I've tried debugging netlify-cli, but no luck so far. Does anyone have a clue what could be the issue?

Steps to reproduce

  1. run git clone [email protected]:hylmar/http2-test.git;
  2. run yarn to install;
  3. run yarn dev to start;
  4. browse https://localhost:8000/; this works;
  5. browse https://localhost:9000/; this says Could not proxy request..

Configuration

[build]
  functions = "build/functions"
  base = ""
  publish = "build"
  command = "npm run deploy"

[dev]
  framework = "#custom"
  command = "koios dev"
  targetPort = 8000
  port = 9000
  publish = "build"
  autoLaunch = false

[dev.https]
  certFile = "cert/localhost-cert.pem"
  keyFile = "cert/localhost-privkey.pem"

Environment

  System:
    OS: macOS 11.6
    CPU: (8) x64 Apple M1
    Memory: 172.72 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.14.0/bin/yarn
    npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
  npmGlobalPackages:
    netlify-cli: 10.3.1

hylmar avatar May 16 '22 09:05 hylmar

@hylmar - I'm having this same issue. Did you find a solution?

dsolanorush avatar Mar 03 '23 18:03 dsolanorush

Hey @dsolanorush, I tried to debug this issue with the given repo but wasn't able to due to unrelated errors in the repository. If you've a public repo where I could reproduce this issue, I can try again.

tinfoil-knight avatar Mar 11 '23 08:03 tinfoil-knight

@tinfoil-knight - the root of the issue for me was two-fold. In nuxt.config.js server config I had:

  1. host set to 0.0.0.0
  2. https cert applied

I completely removed the custom server config and let Nuxt use defaults, then applied my existing cert to the Netlify dev server TOML config. This allowed proxying to work as expected.

dsolanorush avatar Mar 14 '23 23:03 dsolanorush