CORS issue - wasp 0.13
Basically we are getting a lot of CORS issues, such as:
The following is in
And
Pretty much as the guides and other examples shows. Any idea what could be happening?
Best regards
Failed to load resource: the server responded with a status of 401 ()
Origin https://wislearn.io is not allowed by Access-Control-Allow-Origin. Status code: 504
XMLHttpRequest cannot load https://api.wislearn.io/operations/process-task due to access control checks.Failed to load resource: the server responded with a status of 401 ()
Origin https://wislearn.io is not allowed by Access-Control-Allow-Origin. Status code: 504
XMLHttpRequest cannot load https://api.wislearn.io/operations/process-task due to access control checks.The following is in
main.waspmain.wasp:`
wasp: {
version: "^0.13.2"
},
server: {
middlewareConfigFn: import { serverMiddlewareFn } from "@src/serverSetup"
},`
wasp: {
version: "^0.13.2"
},
server: {
middlewareConfigFn: import { serverMiddlewareFn } from "@src/serverSetup"
},And
serverSetup.tsserverSetup.ts content is:`
import cors from 'cors'
import { config, type MiddlewareConfigFn } from 'wasp/server'
export const serverMiddlewareFn: MiddlewareConfigFn = (middlewareConfig) => {
// Set up CORS with allowed origins
middlewareConfig.set('cors', cors({ origin: [config.frontendUrl, 'https://api.wislearn.io', 'https://wislearn.io'] }));
return middlewareConfig;
};`
import cors from 'cors'
import { config, type MiddlewareConfigFn } from 'wasp/server'
export const serverMiddlewareFn: MiddlewareConfigFn = (middlewareConfig) => {
// Set up CORS with allowed origins
middlewareConfig.set('cors', cors({ origin: [config.frontendUrl, 'https://api.wislearn.io', 'https://wislearn.io'] }));
return middlewareConfig;
};Pretty much as the guides and other examples shows. Any idea what could be happening?
Best regards