Skip to Content

Preflight request doesnt pass access control check when sending POST to IoTMMS via WS

I have created an HTML5 app that i am running in HCP which shows sensor data coming off my Raspberry PI which works fine. However i would like to enable bi-directional communication and also be able to send messages to it via the Websockets Push functionality. I have defined my ajax request with the following parameters:

type: 'POST'

headers: "Authorization" : "Bearer b6d385552c9c49090ad65c48e896dc4"


data: ("method":"ws", "sender":"Sensor Monitor Application", "messageType":"243dbaf4dcb840dfafbe", "messages":[ { "photo_request": "false", "led_display": "test test"]}

Where the photo_request boolean is for the pi camera to capture an image and the led_display string to display the message on the LED display.

However when i trigger the call i get the following error. I can send the POST via POSTMAN but not through Chrome as i test my app through WebIDE:

Failed to load resource: the server responded with a status of 401 (Unauthorized)

XMLHttpRequest cannot load Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access. The response had HTTP status code 401.

I have configured Destinations as well which i have read are required to avoid this CORS issue but in my case it does not appear to have any effect. See Destintions below:

Name=IoT_MMS_API Description=IoT MMS API Type=HTTP Authentication=BasicAuthentication CloudConnectorVersion=2 ProxyType=Internet URL=https\:// User=XXXXXX

Name=IOT_RDMS_API Description=IOT_RDMS_API Type=HTTP Authentication=BasicAuthentication CloudConnectorVersion=2 ProxyType=Internet URL=



Does anyone know what's missing in order to push messages to a device from a web interface? I think i've followed the documentation to a T but still appear to be missing something. Thanks in advance for your help!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Feb 22, 2017 at 07:13 AM


    Is this issue resolved? am also facing the same issue, can you tell me how to resolve.



    Add comment
    10|10000 characters needed characters exceeded

  • Feb 22, 2017 at 09:48 AM

    I'd recommend to have a look on a StarterKit example [1], where messages are pushed from web application to the device via HTTP, WS and MQTT.


    Add comment
    10|10000 characters needed characters exceeded