-
Notifications
You must be signed in to change notification settings - Fork 0
Fix CORS configuration to use CorsConfigurationSource and disable frontend dev mode #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: ALNezar <170512776+ALNezar@users.noreply.github.com>
|
@copilot i dont get it what files did you changw |
I changed 2 files:
Commit: 22085aa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes CORS configuration in the backend by properly integrating it with Spring Security's filter chain and disables frontend development mode to enable real API calls.
- Refactored backend CORS from an unintegrated
CorsFilterbean to aCorsConfigurationSourcebean that integrates with the security filter chain - Enabled CORS in the security configuration using
.cors(Customizer.withDefaults()) - Disabled frontend development mode to allow real API requests to the backend
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
backend/src/main/java/com/fishmaster/backend/config/SecurityConfig.java |
Changed CORS from unintegrated filter to properly integrated configuration source, added CORS enablement to security filter chain, updated imports |
frontend/FishMaster/src/services/api.js |
Disabled development mode to enable real API calls instead of mock data |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public CorsConfigurationSource corsConfigurationSource() { | ||
| CorsConfiguration config = new CorsConfiguration(); | ||
| config.setAllowCredentials(true); // allows cookies if needed | ||
| config.setAllowedOrigins(List.of("http://localhost:3000", "http://localhost:5173")); // frontend addresses |
Copilot
AI
Dec 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment has an extra space before "frontend addresses". This is a minor spelling/formatting issue.
| config.setAllowedOrigins(List.of("http://localhost:3000", "http://localhost:5173")); // frontend addresses | |
| config.setAllowedOrigins(List.of("http://localhost:3000", "http://localhost:5173")); // frontend addresses |
Backend CORS was configured as a
CorsFilterbean without being integrated into the security filter chain, preventing proper request handling. Frontend was stuck in dev mode with mock data.Changes
Backend (
SecurityConfig.java)corsFilter()bean tocorsConfigurationSource()returningCorsConfigurationSourceinstead ofCorsFilter.cors(Customizer.withDefaults())toSecurityFilterChainto enable CORS handlingCustomizer,CorsConfigurationSourceFrontend (
api.js)DEV_MODE = falseto enable real API callsOriginal prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.