Use --cors parameter with docker-compose image

rasa-core
rasa-nlu
(Jonas Wolff) #1

Hello guys,

i want to run rasa core and nlu in a docker via docker-compose.

my docker-compose.yml looks like this:

version: '3.0'

services:
    rasa_core:
        image: rasa/rasa_core:latest
        ports:
            - 5005:5005
        volumes:
            - ./models/rasa_core:/app/models
            - ./config:/app/config
        command:
            - start
            - --core
            - models
            - -c
            - rest
            - --endpoints
            - config/endpoints.yml
            - -u
            - current/
    rasa_nlu:
        image: rasa/rasa_nlu:latest-spacy
        volumes:
            - ./models/rasa_nlu:/app/models
            - ./config:/app/config
        command:
            - start
            - --path
            - models
            - -c
            - config/nlu_config.yml
    action_server:
        image: rasa/rasa_core_sdk:latest
        volumes:
            - ./actions:/app/actions

now when i try to talk to the bot with curl -X POST localhost:5005/parse --data '{"q":"hello"}' i get the expected result. However, when i try to send a POST request from my local website via javascript, i get a cors error.

Now i know there is/can be a --cors parameter that can be set to “*” which should work for me. But i don’t know where to set this parameter.

I tried entering it under the command section of the docker for nlu and/or core, but neither worked.

I also tried setting the cors_origins: "*" option in my nlu_config.yml

Can someone explain to me how to get rid of this cors error and send POST requests from the browser?

Thanks in advance

0 Likes