About jmix rest cors settings

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?

Hi,
What Jmix version do you use?

I use the version 1.1 .

only jmix-graphql has the issue.

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