proxy not working
# support
a
const vapi = new Vapi( process.env.NEXT_PUBLIC_VAPI_PUBLIC_KEY || "", 'https://myproxy.com' ); Whatever i use, is not proxying the call to my backend, is going directly to VAPI.
v
It looks like your frontend is set up correctly, but make sure your backend proxy at
https://myproxy.com
is handling the
/call
endpoint and forwarding requests to Vapi. Here’s a minimal example of a proxy handler (e.g., for a Cloudflare Worker):
Copy code
js
export default {
  async fetch(request, env, ctx) {
    if (new URL(request.url).pathname.startsWith('/call')) {
      const response = await fetch(`https://api.vapi.ai/call`, {
        method: 'POST',
        headers: { Authorization: `Bearer ${env.VAPI_API_KEY}`, 'Content-Type': 'application/json' },
        body: await request.text(),
      });
      return new Response(response.body, { status: response.status });
    }
    return new Response('Proxy running');
  }
}
Ensure your proxy is live and accessible at the URL you provide in the frontend. For more details, see the [Vapi proxy server guide](https://docs.vapi.ai/security-and-privacy/proxy-server). Source: - [Proxy server guide](https://docs.vapi.ai/security-and-privacy/proxy-server)
a
which key do I need to use? I'm getting : [VAPI PROXY] Vapi response: {"message":"Invalid Key. Hot tip, you may be using the private key instead of the public key, or vice versa.","error":"Unauthorized","statusCode":401}
ok public key as it's a proxy make sense...
c
checking if this is resolved/solved for you?