invalid server action
Answered
Scaly-naped Pigeon posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Scaly-naped PigeonOP
x-forwarded-host
header with value 115.85.181.105:3000
does not match origin
header with value www.bbangle.store
from a forwarded Server Actions request. Aborting the action.I'm using serveraction
'use server'
import { cookies } from 'next/headers';
export const setCookie = async ({
name,
value,
expires
}: {
name: string;
value: string;
expires?: Date;
}) => {
cookies().set({
name,
value,
httpOnly: true,
path: '/',
expires
});
};
environment: docker + ubuntu
How to fix it?
It works in Development mode
but does not works in Production
![Image](https://cdn.discordapp.com/attachments/1225063567183708190/1225063567569588224/image.png?ex=661fc45b&is=660d4f5b&hm=4e8ac9729f61b993d476e40b645e0e09d04b395610667f7dcb6c3354ab181256&)
Answered by Ray
/** @type {import('next').NextConfig} */
module.exports = {
experimental: {
serverActions: {
allowedOrigins: ['www.bbangle.store'],
},
},
}
try adding the domain in next.config.js
4 Replies
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
/** @type {import('next').NextConfig} */
module.exports = {
experimental: {
serverActions: {
allowedOrigins: ['www.bbangle.store'],
},
},
}
try adding the domain in next.config.js
Answer
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Scaly-naped PigeonOP
oh thank you i'll try it
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Scaly-naped PigeonOP
It works!
I love you 😘
thankyou
I love you 😘
thankyou
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
np