You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting CORS headers to allow using a Remix app as an API for another website is tedious and error prone.
Remix Utils could provide a simple helper to setup that.
cors(response)
Should set all the required headers on the Response object. It can work in two ways:
Change the Response object directly so you can keep using it later.
Return the Response so you can do return cors(json<LoaderData>(data)) to compose them.
Additionally, cors could receive a second object with options to configure it easily.
This helper, could also be used inside entry.server's handleDataRequest function to apply CORS to every data request or manually to each loader and action you want to enable CORS for.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Setting CORS headers to allow using a Remix app as an API for another website is tedious and error prone.
Remix Utils could provide a simple helper to setup that.
Should set all the required headers on the Response object. It can work in two ways:
return cors(json<LoaderData>(data))
to compose them.Additionally,
cors
could receive a second object with options to configure it easily.This helper, could also be used inside
entry.server
'shandleDataRequest
function to apply CORS to every data request or manually to each loader and action you want to enable CORS for.Beta Was this translation helpful? Give feedback.
All reactions