> For the complete documentation index, see [llms.txt](https://docs.scandipwa.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scandipwa.com/getting-started-1/storefront-mode/proxying-requests-to-server.md).

# Proxying requests to server

To tell the development server to proxy requests to your Magento 2 server, modify a `proxy` field to your `package.json`, for example:&#x20;

```javascript
"proxy": "http://localhost:4000",
```

{% hint style="warning" %}

### Heads up!

This feature is only supported in `development` (when using [`start` command](/developing-with-scandi/developer-tools/available-commands.md#npm-start-or-yarn-start)).
{% endhint %}

## Configuring proxy manually

If the `proxy` option is **not** flexible enough for you, you can get direct access to the Express app instance and hook up your own proxy middleware.

You can use this feature in conjunction with the `proxy` property in `package.json`, but it is recommended you consolidate all of your logic into `src/setupProxy.js`.

First, install `http-proxy-middleware` using npm or Yarn:

```bash
npm install http-proxy-middleware --save # for NPM
yarn add http-proxy-middleware # for Yarn
```

Next, create `src/setupProxy.js` and place the following contents in it:

```javascript
const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function(app) {
  // ...
};
```

You can now register proxies as you wish! Here's an example using the above `http-proxy-middleware`:

```javascript
const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function(app) {
  app.use(
    '/graphql',
    createProxyMiddleware({
      target: 'http://localhost:5000',
      changeOrigin: true,
    })
  );
};

```

{% hint style="warning" %}

### Heads up!

You do not need to import this file anywhere. It is automatically registered when you start the development server.
{% endhint %}

## Configuring Magento 2 server

To use Magento 2 as a data source for ScandiPWA, you are required to make sure that it is using the correct Composer dependencies. The list of your application Composer dependencies can be found in your ScandiPWA application's `composer.json` file.

You can copy the dependencies defined in `require` field of your application's `composer.json` to your Magento server's root `composer.json`  and execute the `composer update` command.
