Cloudflare Pages Bug? Post results in 405 because it's trying to serve static

For Workes & Pages, what is the name of the domain?

nothingliveyet

What is the error number?

405

What is the error message?

[wrangler:inf] POST /api/content 405 Method Not Allowed

What is the issue or error you’re encountering

The local wrangler pages dev command starts server at http://localhost:8788, but when making POST requests to functions it results in 405. There seems to be no config to run functions on a different port?

PS: I’m talking about fetch requests to function endpoints like:

const response = await fetch(/api/something, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(payload),
      signal: controller.signal,
    });

/api is proxied via vite:

proxy: {
      '/api': {
        target: 'http://localhost:8788', // Cloudflare Worker local development server (Wrangler port)
        changeOrigin: true,
        secure: false,
      }
    },

My functions/index.js is not even triggered, but I can see cli logs like [wrangler:inf] POST /api/content 405 Method Not Allowed (12ms)

Which seems to happen because the local wrangler dev server tries to serve static assets?

When I change to GET, it actually works and the function is triggered.

This seems like it’s a bug?

Actually, when i change it to GET, i do get a 200 OK. But the payload is not there, instead it’s the index.html that is returned…

How can I use functions locally then?!