a616101
(Bruce Chen)
November 10, 2021, 9:08am
1
Hi Team:
I found the setting: jmix.rest.allowed-origins in application.properties
When i have set it up, and use graphql query (/graphql), I found it doesn’t work.
and all response header always get Access-Control-Allow-Origin: *
This means that the cors setting is invalid in this case(/graphql).
p.s. I use this addon: Haulmont/jmix-graphql: GraphQL integration project of the Jmix framework (github.com)
Am I missing any settings?
gorbunkov
(Maxim Gorbunkov)
November 12, 2021, 12:27pm
3
Hi,
What Jmix version do you use?
a616101
(Bruce Chen)
November 12, 2021, 4:17pm
4
I use the version 1.1 .
only jmix-graphql has the issue.
gorbunkov
(Maxim Gorbunkov)
November 16, 2021, 6:57am
5
jmix.rest.allowed-origins property is a part of another add-on (jmix-rest), so it shouldn’t work for graphql.
I’ve created an issue to add a similar property to the jmix-graphql.
In the meantime, you may configure CORS for /graphql in your application:
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/graphql").allowedOrigins("http://localhost:3000");
}
};
}
1 Like