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

routeRules proxy error #2615

Open
ZenoHu opened this issue Jul 16, 2024 · 0 comments
Open

routeRules proxy error #2615

ZenoHu opened this issue Jul 16, 2024 · 0 comments

Comments

@ZenoHu
Copy link

ZenoHu commented Jul 16, 2024

Environment

mac

Reproduction

https://codesandbox.io/p/devbox/pensive-poitras-3xsl4r?embed=1&file=%2Fserver%2Fapi%2Fv1%2Fupload.post.ts

Describe the bug

  1. in nuxt.config.ts
  routeRules: {
    "/proxy/**": {
      proxy: {
        to: "/api/v1/**",
      },
    },
  },
  1. in upload.post.ts
import { IncomingForm } from "formidable";

export default defineEventHandler(async (event) => {
  event.node.req.on("data", (chunk) => {
    // will not log when submit to /proxy/upload
    console.log("data received", chunk);
  });

  const form = new IncomingForm({ uploadDir: "./upload" });

  form.parse(event.node.req, (_, __, files) => {
    // will not log when submit to /proxy/upload
    console.log(files);
  });

  return "success";
});

Additional context

No response

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant