JillzTom's avatar

Proxy Ajax Calls in Laravel Mix

I'm trying to proxy an API call in a .vue component in Laravel project. In the webpack.mix.js file, I added:

mix.webpackConfig({
    devServer: {
      proxy: {
        "/v1": {
          target: "https://api.example-uat.io/",
          changeOrigin: true
        }
      }
    }
});

I run npm run watch to auto compile the changes. However, the proxying doesn't seem to work.

├─┬ [email protected]
│ └── [email protected]  deduped
└── [email protected]

I keep on getting 404 Not found error upon running it. Seems like the proxying doesn't work.

The Laravel App doesn't have the requested route. That's why it's proxied to an open-ended API server.

Is there any other way to achieve this proxying?

0 likes
0 replies

Please or to participate in this conversation.