invalid server action
Answered
Scaly-naped Pigeon posted this in #help-forum
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
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
@Scaly-naped Pigeon `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
/** @type {import('next').NextConfig} */
module.exports = {
experimental: {
serverActions: {
allowedOrigins: ['www.bbangle.store'],
},
},
}
try adding the domain in next.config.js
Answer
Scaly-naped PigeonOP
oh thank you i'll try it
Scaly-naped PigeonOP
It works!
I love you 😘
thankyou
I love you 😘
thankyou