spring-cloud / spring-cloud/spring-cloud-gateway
Spring Cloud Gateway - CORS issue (preflight request and response is success but actual request's response is FORBIDDEN)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
Hello Together,
Below is my Global CORS configuration (i.e. in application.yml file) in the Spring Cloud API Gateway application and my preflight response is success.
But then the actual graphql micro service request is failed with 403 FORBIDDEN error.
Please help to solve the issue.
Note:
- I didn't configure spring security (i.e. didn't add spring-boot-starter-security dependency) in both Spring cloud gateway application and graphql spring boot application (i.e. Micro service).
- Except graphql micro service other normal spring boot application request and response is success via Spring Cloud API Gateway.
Spring Boot Version : 2.7.2
global cors configuration
globalcors:
add-to-simple-url-handler-mapping: true
cors-configurations:
'[/**]':
allowedOrigins: "*"
allowedHeaders: "*"
allowedMethods: "*"
Prelflight Request and Response:

Actual Request and Response

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the application.yml global CORS configuration and compare the successful preflight request with the forbidden actual GraphQL request. Reproduce the behavior using Spring Boot 2.7.2 through the Spring Cloud Gateway, then determine what distinguishes the GraphQL route from the other successful Spring Boot application routes. Done means the actual request succeeds or the cause of the 403 is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100