# Gateway to Router - persistedQueries/cache

**URL:** <https://community.apollographql.com/t/gateway-to-router-persistedqueries-cache/5505>\
**Category:** Router\
**Tags:** router\
**Created:** [January 18, 2023, 8:47pm UTC](https://community.apollographql.com/t/gateway-to-router-persistedqueries-cache/5505 "2023-01-18T20:47:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsiqueira](https://avatars.discourse-cdn.com/v4/letter/t/919ad9/32.png) [@tsiqueira](https://community.apollographql.com/u/tsiqueira)\
**Post date:** [January 18, 2023, 8:47pm UTC](https://community.apollographql.com/t/gateway-to-router-persistedqueries-cache/5505/1 "2023-01-18T20:47:55Z")

</div>

Hi,

I’m working on migrating from gateway to router. I have router working at the moment with basic configuration, but I’m working on migrating some of our existing Apollo Server constructor configuration.

We were passing in the following parameters to ApolloServer:

```auto
csrfPrevention: true,
persistedQueries: false,
cache: 'bounded',
formatError: formatError

```

Questions:

- Can you confirm that csrlPrevention is set to true by default, so there’s no need to explicitly name it?
- Is there a way to migrate persistedQueries and cache: bounded to Router?
- We were also using “formatError” to pass in a custom error formatting function. Is there a way to migrate that to Router?

Thanks,  
TS

---

<div class="post-metadata">

**Author:** ![watson](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/watson/32/2053_2.png) [@watson](https://community.apollographql.com/u/watson)\
**Post date:** [January 18, 2023, 10:09pm UTC](https://community.apollographql.com/t/gateway-to-router-persistedqueries-cache/5505/2 "2023-01-18T22:09:34Z")

</div>

Hi,

- For CSRF Prevention, Apollo Router 0.9 introduced a CSRF prevention feature, that is enabled by default. [(docs)](https://www.apollographql.com/docs/router/configuration/csrf)
- For Persisted Queries, this will be coming soon
- For format errors, you probably will still want to do that at the subgraph level. By default, [subgraph errors aren’t included in responses for the router but you can configure that](https://www.apollographql.com/docs/router/configuration/subgraph-error-inclusion):

```auto
include_subgraph_errors:
  all: true # Propagate errors from all subgraphs
  subgraphs:
    products: false # Do not propagate errors from the products subgraph

```

A custom Rhai script would be able to do whatever else you needed in addition to the error formating.

If you want to chat more about your migration, you can join us in our [Discord server](https://discord.gg/graphos) and ping me (@watson). Hope to see you there!
