Hello. I have extension working on localhost and want to move it to hosted test. The problem is I can’t connect from config page with EBS (on Heroku) because of “Access-Control-Allow-Origin”. I tried to add exact url and base server url into Whitelist Config Urls but it didn’t helped. What can be the problem?
You need to send the Access-Control-Allow-Origin header in your response from your EBS on Heroku.
1 Like
If your EBS is built with Node.js, add something like this https://github.com/xzion/twitch-extension-demo/blob/c68bb9cbb80c737b0720e1b8b7b25c412d9cd555/app.js#L29
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: x-extension-jwt, platform');
Would be for PHP. Obviously you’d want to change Methods
and Headers
to match what you’re doing. You may not need all of the methods, and you may have more than just x-extension-jwt
and platform
.
Your response from your EBS needs to include the header:
Access-Control-Allow-Origin
which it does not, causing the browser to block the response. You can use Fiddler or Chrome/Firefox dev tools to inspect the response and check for headers.