cli icon indicating copy to clipboard operation
cli copied to clipboard

HTTP 200 proxy redirects do not seem to work correctly in `netlify dev`

Open nolessafool opened this issue 3 years ago • 1 comments

Describe the bug

HTTP 200 redirects seem to be mishandled under netlify dev, returning a location header incorrectly.

There should be no location set on an HTTP 200 proxy rule; we should only serve the content. Said redirect does work as expected in production, and I believe that production is correct here.

Steps to reproduce

When running netlify dev with a 200 status redirect like this:

/:placeholder/signup/page.html /:placeholder/signup.html 200!

then, using cURL to test locally, we see this response:

% curl -I http://localhost:3000/en-us/signup/page.html
HTTP/1.1 200 OK
etag: W/"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"
location: /en-us/signup.html
date: Fri, 22 Apr 2022 05:37:37 GMT
connection: close

Configuration

n/a

Environment

 System:
    OS: macOS 11.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 479.76 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
    npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
  npmGlobalPackages:
    netlify-cli: 10.0.0

nolessafool avatar Apr 22 '22 18:04 nolessafool

@fool I've not been able to reproduce the issue.

I created a directory with redirect as specified. I'm not getting the location header from curl.

% curl -I "http://localhost:8888/en-us/signup/page.html"

HTTP/1.1 200 OK
etag: W/"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"
x-powered-by: netlify-dev
date: Sat, 06 Aug 2022 11:40:17 GMT
content-type: text/html
content-length: 106
connection: close

Repo: https://github.com/KK-Learning-Gym/4561-redirect-200

CLI Version: 10.15.0

tinfoil-knight avatar Aug 06 '22 11:08 tinfoil-knight

Also not able to reproduce this anymore. #5005 includes tests that actually test this.

danez avatar Aug 26 '22 16:08 danez