flat-fuchsia
flat-fuchsia2mo ago

How to disable OPTIONS requests?

When using simple-rest package with my custom endpoint I receive few OPTIONS request when attempting to list a products list. That OPTIONS http method is not supported on my backend. I read some docs around this but Im not able to make it work, looks like adding onSearch: undefined should do the trick, but it's not working. Anyone know how to do this?
3 Replies
kapa.ai
kapa.ai2mo ago
Hi @currycode. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but the knowledge sources do not contain explicit information on how to disable or prevent HTTP OPTIONS requests when using the simple-rest data provider in refine. The documentation describes how to customize HTTP methods for specific data provider calls (e.g., using the meta property to set the method to PUT instead of PATCH), but it does not mention disabling OPTIONS requests or controlling preflight behavior at the refine or simple-rest level Simple REST data provider. OPTIONS requests are typically triggered by the browser as part of CORS (Cross-Origin Resource Sharing) preflight checks, not directly by refine or its data providers. Setting onSearch: undefined is related to client-side filtering in select/autocomplete components and does not affect the HTTP methods used for data fetching Ant Design useSelect onSearch Material UI useAutocomplete onSearch. If your backend does not support OPTIONS, you may need to adjust your server's CORS configuration or ensure that your frontend and backend are served from the same origin to avoid preflight requests. However, this is outside the scope of refine's documented features. If you need further assistance, you may want to consult your backend/server documentation or seek advice on CORS handling specific to your stack. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@761707070445584404> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
flat-fuchsia
flat-fuchsiaOP2mo ago
Sorted locally changing CORS configuration 👍

Did you find this page helpful?