Skip to content
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

Access-Control-Allow-Methods contains duplicate HTTP methods [SPR-14792] #19358

spring-projects-issues opened this issue Oct 10, 2016 · 0 comments


Copy link

@spring-projects-issues spring-projects-issues commented Oct 10, 2016

Mark Paluch opened SPR-14792 and commented

HTTP Header Access-Control-Allow-Methods contains duplicate method names using CORS Preflight requests. This happens when global, and handler CORS configurations are combined. Seems this can happen also for other CORS headers, see CorsConfiguration.combine .

class Config extends WebMvcConfigurerAdapter {

	public void addCorsMappings(CorsRegistry registry) {

class MyRestController {

	@RequestMapping(value = "/resource", method = RequestMethod.GET)
	String resource() {
		return "OK";

public void allowedMethodsShouldContainUniqueMethodNames() throws Exception {

			.perform(options("/resource") //
					.header(HttpHeaders.ORIGIN, "http://far.far.away") //
					.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"))
			.andExpect(status().isOk()) //
			.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET"));

Affects: 4.3 GA

Referenced from: commits f5ecdda, 9bf8489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants