Lohith Arcot
Lohith Arcot

Reputation: 1186

POST request changes to OPTIONS in RASA

The postman post request return a response from RASA NLU, however when replicating the same thing via the browser, the post request changes from POST request to OPTIONS request and there is no response from RASA NLU API.

Upvotes: 2

Views: 1309

Answers (1)

Lohith Arcot
Lohith Arcot

Reputation: 1186

To fix this issue, you need to pass the command option

--auth-token < put your custom token here >

You can also pass None as auth token which is the default option as follows.

rasa run -m models --enable-api --log-file out.log --cors "*"  --endpoints endpoints.yml --debug --auth-token None

Also you need to change your POST request by adding the token as payload.

for example:

$.ajax({
  url: 'http://localhost:5005/webhooks/rest/webhook/',
  method: 'POST',
  contentType: 'application/json',
  data: JSON.stringify({
    message: msg,
    sender: name,
    token: 'None'
  })

Restart the NLU server and clear cached JavaScript if present by hitting CTRL+SHIFT+R. Now the CORS policies should not be a problem.

Upvotes: 3

Related Questions