Skip to content

Commit

Permalink
Merge pull request #76 from asad-rafter/CLD-256-PD-CORS-error
Browse files Browse the repository at this point in the history
resolved CORS error
  • Loading branch information
yuval-cloudinary authored Jun 13, 2024
2 parents c5149e4 + 0a2d7c1 commit b1aa7c2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ server.get('info', server.middleware.https, function (req, res, next) {
var publicId = req.querystring.publicId;
var type = req.querystring.type;
var rType = req.querystring.rType;
res.setHttpHeader('Access-Control-Allow-Origin', '*');
if (publicId) {
var info = getAssetInfo(publicId, type, rType);
res.json({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function getBreackpoints(publicId) {

server.get('Points', server.middleware.https, function (req, res, next) {
var publicId = req.querystring.publicId;
res.setHttpHeader('Access-Control-Allow-Origin', '*');
if (publicId) {
var brs = getBreackpoints(publicId);
res.json({
Expand Down
4 changes: 2 additions & 2 deletions cartridges/int_cloudinary_pd/cartridge/controllers/Links.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var URLParamter = require('dw/web/URLParameter');

server.get('url', server.middleware.https, function (req, res, next) {
var linkArr = (req.querystring && req.querystring.linkData) ? JSON.parse(decodeURIComponent(req.querystring.linkData)) : null;
res.setHttpHeader('Access-Control-Allow-Origin', '*');
if (linkArr && linkArr.length > 0) {
// eslint-disable-next-line new-cap
var url = new URLUtils.abs(new URLAction(linkArr[0], currentSite.name), new URLParamter(linkArr[1], linkArr[2]));
var link = {
status: 'ok',
url: url.toString()
url: linkArr.toString()
};
res.json(link);
} else {
Expand Down

0 comments on commit b1aa7c2

Please sign in to comment.