albert_wong
02/15/2025, 11:01 PMhttps://localhost:5173
- Production API at https://api.progressnotes.app
- Admin frontend works https://app.progressnotes.app
Problem:
I'm getting these pesky CORS errors when trying to authenticate against production API from local dev environment:
ERRORS: Access to fetch at 'https://api.progressnotes.app/auth/method' from origin 'https://localhost:5173' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Here's my Current Configuration:
1. AWS Parameter Store settings:
- `/medplum/prod/appBaseUrl`: https://app.progressnotes.app/
- `/medplum/prod/baseUrl`: https://api.progressnotes.app/
- `/medplum/prod/allowedOrigins`: *
2. Client Configuration (main.tsx):
const medplum = new MedplumClient({
onUnauthenticated: () => (window.location.href = '/'),
baseUrl: 'https://api.progressnotes.app/',
});
What I've Tried:
1. Set allowedOrigins to * in AWS Parameter Store
2. Restarted the Medplum server after config changes
3. Verified all required parameters are set in AWS Parameter Store
4. Checked network tab - preflight OPTIONS request fails with CORS error
5. Confirmed server configuration is being loaded with correct values
Request Headers:
accept: application/fhir+json, /; q=0.1
content-type: application/fhir+json
referer: https://localhost:5173/
Questions:
1. Is there additional CORS configuration needed beyond allowedOrigins?
2. Should I be setting additional headers in the MedplumClient configuration?
3. Are there any known issues with local development against production APIs?
Any help would be greatly appreciated!thomabig
04/24/2025, 3:36 PMthomabig
04/24/2025, 4:00 PM