HTTP requests possible in server actions? #66114
-
We have a setup where we run our next.js application on Vercel, but the backend stuff (database, data handling) is on a different server. So we actually have 2 servers, one for delivering the UI (Vercel) and the other for data handling. So my question is: Is it ok to put a post request in the server actions to reach out to our second server? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes you should be able to forward a request from the server action to a 3rd party, just remember that this would run in the context of the server, so cookies and other stuff that the client has set, won't be available when you craft the request from within the server action. |
Beta Was this translation helpful? Give feedback.
Yes you should be able to forward a request from the server action to a 3rd party, just remember that this would run in the context of the server, so cookies and other stuff that the client has set, won't be available when you craft the request from within the server action.