Server Action Errors
Answered
Southeastern blueberry bee posted this in #help-forum
Southeastern blueberry beeOP
my error
im callinig a function from client to server
`x-forwarded-host` header with value `localhost:3004` does not match `origin` header with value `dashboard.???.???` from a forwarded Server Actions request. Aborting the action.
⨯ Error: Invalid Server Actions request.
at AsyncLocalStorage.run (node:async_hooks:346:14)
at AsyncLocalStorage.run (node:async_hooks:346:14)im callinig a function from client to server
'use server'
import axios from 'axios';
export async function checkInformation(username: string, password: string) {
const response = axios.get(`...`)
console.log(response)
}10 Replies
Southeastern blueberry beeOP
hello again lol @Ray
@Southeastern blueberry bee my error
js
`x-forwarded-host` header with value `localhost:3004` does not match `origin` header with value `dashboard.???.???` from a forwarded Server Actions request. Aborting the action.
⨯ Error: Invalid Server Actions request.
at AsyncLocalStorage.run (node:async_hooks:346:14)
at AsyncLocalStorage.run (node:async_hooks:346:14)
im callinig a function from client to server
ts
'use server'
import axios from 'axios';
export async function checkInformation(username: string, password: string) {
const response = axios.get(`...`)
console.log(response)
}
try adding this to your next.config
const nextConfig = {
experimental:{
serverActions: {
allowedOrigins: ['localhost:3004']
}
}
};@Ray try adding this to your next.config
ts
const nextConfig = {
experimental:{
serverActions: {
allowedOrigins: ['localhost:3004']
}
}
};
Southeastern blueberry beeOP
alr 1 sec
Southeastern blueberry beeOP
@Ray when im visiting the website from my local machine with my ip in address bar, theres no provlems with that but when im running it on my vps and and accessing the the website from my domain name where im usinig nginx i get that error
@Ray try adding this to your next.config
ts
const nextConfig = {
experimental:{
serverActions: {
allowedOrigins: ['localhost:3004']
}
}
};
Southeastern blueberry beeOP
this has no fix
@Southeastern blueberry bee <@743561772069421169> when im visiting the website from my local machine with my ip in address bar, theres no provlems with that but when im running it on my vps and and accessing the the website from my domain name where im usinig nginx i get that error
I think you need to add your domain to
allowedOriginsAnswer
dashboard.???.???
Southeastern blueberry beeOP
alr
Southeastern blueberry beeOP
@Ray how do i set cookies??
@Southeastern blueberry bee <@743561772069421169> how do i set cookies??
you could use
cookies() in server action