Conversation
Co-authored-by: ALNezar <170512776+ALNezar@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix backend-frontend communication issues with CORS adjustments
Fix CORS configuration to use CorsConfigurationSource and disable frontend dev mode
Dec 20, 2025
Owner
|
@copilot i dont get it what files did you changw |
Contributor
Author
I changed 2 files:
Commit: 22085aa |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
The comment has an extra space before "frontend addresses". This is a minor spelling/formatting issue.
Suggested change
| config.setAllowedOrigins(List.of("http://localhost:3000", "http://localhost:5173")); // frontend addresses | |
| config.setAllowedOrigins(List.of("http://localhost:3000", "http://localhost:5173")); // frontend addresses |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.