# React accelerator multiple channel url issue

**URL:** <https://forum.litium.com/t/react-accelerator-multiple-channel-url-issue/3166>\
**Category:** Questions\
**Tags:** accelerator, litium-8\
**Created:** [December 14, 2023, 12:58pm UTC](https://forum.litium.com/t/react-accelerator-multiple-channel-url-issue/3166 "2023-12-14T12:58:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shine.s](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@shine.s](https://forum.litium.com/u/shine.s)\
**Post date:** [December 14, 2023, 12:58pm UTC](https://forum.litium.com/t/react-accelerator-multiple-channel-url-issue/3166/1 "2023-12-14T12:58:30Z")

</div>

When we have to publish the same website to different channels (for say, different languages), we create a channel, associate it with the website, published everything in that channel, and set the url. And if we are using the same domain for both the channels,  
we set a prefix. For example, we have a domain `example.com`, this will be used for the default channel. Now we create a new channel for English, with a prefix `en`. Now this can be accessed at `example.com/en`.

Ideally we should expect both these routes to work, with `example.com` serving the default homepage and `example.com/en` serving the English homepage.

Currently we can access the default home page by going to `example.com`. But accessing the new channel prefix, `example.com/en` gives a not found error, consequently a `429: Too many requests` error.

```auto
○ Compiling /not-found ...
 ✓ Compiled /not-found in 1082ms (1680 modules)
[GraphQL Network error for url https://example.com/storefront.graphql]: ServerError: Response not successful: Received status code 429
Stack: ServerError: Response not successful: Received status code 429
    at throwServerError (webpack-internal:///(rsc)/./node_modules/@apollo/client/link/utils/throwServerError.js:6:17)
    at parseJsonBody (webpack-internal:///(rsc)/./node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js:133:74)
    at eval (webpack-internal:///(rsc)/./node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js:187:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
 ⨯ node_modules\@apollo\client\errors\index.js (39:27) @ call
 ⨯ ApolloError: Response not successful: Received status code 429
    at new Promise (<anonymous>)
    at Array.forEach (<anonymous>)

```

We tried sending a getContentType query using Banana Cake Pop from `example.com/en`. And it responds with a `Redirect`. And then we tried `example.com/en/` This time however, the response was `HomePage`. So it’s just a single fore-slash ( **/** ) that we need to avoid this redirect loop.

**middleware:**  
This time I tried making the following changes in `middleware.ts` to add a ‘/’ at the end of the url

```TypeScript
url: `${request.nextUrl.pathname}/?${request.nextUrl.searchParams}`

```

And, It worked.

This time however got another error

**The HomePage Template:**  
The templates will send a getContent query to the API, here also the ‘/’ was causing it to get a `redirect` Instead of the content.

```TypeScript
await queryWithHeader({

      query: GET_CONTENT,

      url: params.slug?.join('/') ?? '/',

      headers: headers(),

    })

  ).content;

```

```TypeScript
return await createMetadataFromUrl(params.slug?.join('/'), headers());

```

So, I made changes to both of them as well

```TypeScript
await queryWithHeader({

      query: GET_CONTENT,

      url: `${params.slug?.join('/')}/` ?? '/',

      headers: headers(),

    })

  ).content;

```

```TypeScript
return await createMetadataFromUrl(

    `${params.slug?.join('/')}/` ?? '/',

    headers()

  );

```

It was a success; Accessing `example.com/en/` now responded with the home page.

But this caused the default homepage to crash

Litium version: 8.13.0

React accelerator: 1.0.0-rc-02

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [January 11, 2024, 12:58pm UTC](https://forum.litium.com/t/react-accelerator-multiple-channel-url-issue/3166/2 "2024-01-11T12:58:42Z")

</div>

Closed on January 11, 2024, 12:58pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
