mirror of
https://github.com/lucasrcsantana/story-generator.git
synced 2025-12-16 13:27:52 +00:00
fix: corrigindo CORS Headers
Some checks are pending
Docker Build and Push / build (push) Waiting to run
Some checks are pending
Docker Build and Push / build (push) Waiting to run
This commit is contained in:
parent
0c2a63dcd3
commit
198cad0047
@ -6,6 +6,8 @@ const nextConfig = {
|
||||
'oaidalleapiprodscus.blob.core.windows.net',
|
||||
'leiturama.ai',
|
||||
'localhost',
|
||||
'bsjlbnyslxzsdwxvkaap.supabase.co',
|
||||
'leiturama.netlify.app'
|
||||
],
|
||||
formats: ['image/avif', 'image/webp'],
|
||||
minimumCacheTTL: 60,
|
||||
|
||||
@ -20,7 +20,7 @@ export const generateStoryFunction = async (prompt: StoryPrompt) => {
|
||||
const { data: { session } } = await supabase.auth.getSession()
|
||||
|
||||
const response = await fetch(
|
||||
'https://seu-project-ref.supabase.co/functions/v1/generate-story',
|
||||
'https://bsjlbnyslxzsdwxvkaap.supabase.co/functions/v1/generate-story',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
||||
@ -18,7 +18,8 @@ interface StoryPrompt {
|
||||
const ALLOWED_ORIGINS = [
|
||||
'http://localhost:5173', // Vite dev server
|
||||
'http://localhost:3000', // Caso use outro port
|
||||
'https://leiturama.ai' // Produção
|
||||
'https://leiturama.ai', // Produção
|
||||
'https://leiturama.netlify.app'
|
||||
];
|
||||
|
||||
interface StoryResponse {
|
||||
@ -48,9 +49,10 @@ serve(async (req) => {
|
||||
const corsHeaders = {
|
||||
'Cross-Origin-Resource-Policy': 'cross-origin',
|
||||
'Access-Control-Allow-Origin': ALLOWED_ORIGINS.includes(origin) ? origin : ALLOWED_ORIGINS[0],
|
||||
'Access-Control-Allow-Methods': 'POST, OPTIONS',
|
||||
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, PUT, DELETE',
|
||||
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
|
||||
'Access-Control-Max-Age': '86400', // 24 horas
|
||||
'Cross-Origin-Embedder-Policy': 'credentialless'
|
||||
};
|
||||
|
||||
// Preflight request
|
||||
|
||||
Loading…
Reference in New Issue
Block a user