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

@CrossOrigin on rest repositories does not work with configured base path [DATAREST-1019] #1381

Closed
spring-projects-issues opened this issue Mar 7, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@spring-projects-issues
Copy link

Patrik Mihalcin opened DATAREST-1019 and commented

I'm using Spring Boot 1.5.2.RELEASE and dependencies spring-boot-starter-data-rest and spring-boot-starter-data-jpa. This transitively pulls in spring-data-rest-core 2.6.1.RELEASE which is supposed to have CORS support based on the reference documentation and DATAREST-573.

My web application works fine and I expose REST api using app property spring.data.rest.base-path=/api. When I annotate my repo with @CrossOrigin annotation, e.g.

@CrossOrigin
public interface GroupRepository extends PagingAndSortingRepository<Group, Long>, QueryDslPredicateExecutor<Group> {
    List<Group> findByName(@Param("name") String name);
}

Spin up the application and invoke the following curl command:

curl -v -H "Accept: application/hal+json" -H "Origin: http://localhost:1234" http://localhost:8080/api/groups

The server side doesn't return CORS headers: Access-Control-Allow-Credentials, Access-Control-Allow-Origin


Affects: 3.0 M1 (Kay), 2.6.1 (Ingalls SR1)

Referenced from: pull request #259

Backported to: 2.6.2 (Ingalls SR2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants