KevinVandy/material-react-table

CORS Issues with Documentation Example

IThoughtYouKnow opened this issue · 1 comments

material-react-table version

v2

react & react-dom versions

inherit from example config

Describe the bug and the steps to reproduce it

Hello!

I've found an issue with the documentation example: lazy-sub-rows sandbox.

The following code snippet is causing problems:

process.env.NODE_ENV === 'production'
  ? 'https://www.material-react-table.com'
  : 'http://localhost:3000',
);

The issue is that when trying to use this example in sandboxes like Stackblitz, there are CORS issues when accessing https://www.material-react-table.com. Additionally, it is not possible to set up a proxy in Vite like this:

server: {
  proxy: {
    '/api/treedata': {
      target: 'https://www.material-react-table.com',
      changeOrigin: true,
    }
  }
}

The problem is that the browser cannot modify headers, so the example only works locally with a properly configured proxy.

I suggest updating the example and/or documentation to account for these limitations.

Thank you for your attention!

Minimal, Reproducible Example - (Optional, but Recommended)

Simply open the sandbox from the documentation, and you will encounter the issue.

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

None

Terms

  • I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

This is known and intentional so that my vercel bill doesn't go high from everyone trying to hit my backend