Strangely I am only seeing this issue in my local environment, my remote production setup works fine. I'm using entirely out of the box backend and admin, running backend the with docker-compose along with Redis and Postgres on the same docker network. I pass the following env vars into my medusa backend container:
environment:
NODE_ENV: development
STORE_CORS: http://localhost:9500,http://127.0.0.1:9500
ADMIN_CORS: http://localhost:9501,http://127.0.0.1:9501
DATABASE_URL: postgres://postgres:postgres@db:5432/dbname
REDIS_URL: redis://cache:6379
JWT_SECRET: local_jwt_secret
COOKIE_SECRET: local_cookie_secret
PORT: 8080
And I launch the admin UI with the command vite --port 9501 which can then successfully be accessed by either of the of the provided ADMIN_CORS urls.
The error in the web console I am receiving is:
Access to XMLHttpRequest at 'http://localhost:9502/admin/auth' from origin 'http://localhost:9501' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
while attempting to login to the admin panel. The same errors occur with respective ports on my store front however my storefront is custom built so I avoid focusing on that for now as it could contain user error. This however is more or less a fresh clone of the medusa admin repo + a very simple medusa docker container with no custom edits and which has already proven to work properly in remote environment.
I also shelled into the local backend container and echod the ADMIN_CORS var and its properly set, I also attempted with other variations with and without the , delimiter. Actually I had more luck when I was routing via local NGINX.