Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netlify Dev issues a 301 redirect when a rewrite is specified #1720

Closed
ryaninvents opened this issue Jan 11, 2021 · 1 comment
Closed

Netlify Dev issues a 301 redirect when a rewrite is specified #1720

ryaninvents opened this issue Jan 11, 2021 · 1 comment
Labels
type: bug code to address defects in shipped code

Comments

@ryaninvents
Copy link

Describe the bug

When running netlify dev locally, visiting a path that I have proxied results in a 301 redirect to a path beginning with .netlify/functions/.

To Reproduce

Steps to reproduce the behavior:

  1. Write a Netlify function
  2. Create a redirect rule in _redirects proxying to your function; for example:
    / /.netlify/functions/index 200
  3. Run netlify dev
  4. Visit the locally-running application in your browser
  5. See that the URL has changed to begin with /.netlify/functions/ instead of the requested URL

Configuration

  • netlify.toml
[build]
  command = 'yarn build'
  publish = 'build'
  functions = 'build-functions'
[dev]
  publish = 'build'
  functions = 'src/functions'
  • Please enter the following command in a terminal and copy/paste its output:
% npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli

  System:
    OS: macOS 11.0.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 131.76 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.18.2 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
% yarn why netlify-cli   
yarn why v1.22.4
[1/4] 🤔  Why do we have the module "netlify-cli"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "netlify-cli@2.71.0"
info Reasons this module exists
   - "_project_#app" depends on it
   - Hoisted from "_project_#app#netlify-cli"
info Disk size without dependencies: "1.9MB"
info Disk size with unique dependencies: "31.63MB"
info Disk size with transitive dependencies: "244.82MB"
info Number of shared dependencies: 262
✨  Done in 1.49s.

Expected behavior

Netlify Dev should render the output of my index function and return 200 instead of returning the 301.

@ryaninvents ryaninvents added the type: bug code to address defects in shipped code label Jan 11, 2021
@ryaninvents
Copy link
Author

Can't reproduce this any more, but I'm not sure what I changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant