messages.forbiddenorigin when updating a page

Charles Owen asked on August 18, 2024 19:47

Thanks in advance for any help. New to a Kentico project and trying to get the CMS application running locally, with database hosted by Azure.

The problem: I am able to create a new page, but when I attempt to add content by clicking the Save button on the Page tab I receive the error "messaging.forbiddenorigin."

Troubleshooting thus far:

This is a javascript error that originates in the builder.js file in the .../Kentico/Scripts/builders folder. There is an onClick method that must eventually use this script.

In my database, the values for SiteDomainName and SitePresentationURL are "localhost:56866" and "http://localhost:56866/" respectively, and this is the domain:port where the website would be running.

The CMS application is accessible on http://localhost:51872/.

I don't seem to have the "Licenses Application" or the "Sites Application"--seems odd, but as I said I'm inheriting a mature project and I'm not sure how the codebase has evolved over time.

I've looked in the CMS_LicenseKey table, and there is a record with LicenseDomain value "localhost", and LicenseEdition "B". No port mentioned.

I happy to share lightly edited sections of web.config file as needed.

There is nothing in the event log (maybe because nothing is being submitted to the server; the error arises in the onClick method for the save button).

Any guidance would be very helpful!

Thanks again, Charles

Recent Answers


Charles Owen answered on August 19, 2024 15:56 (last edited on August 19, 2024 16:00)

Here is the method in builder.js that causes the message to be shown:

S = (function () {
    function e() {}
    return (
        (e.prototype.registerListener = function (e, t, n) {
            window.addEventListener("message", this.makeReceiveMessage(e, t, n));
        }),
        (e.prototype.makeReceiveMessage = function (e, t, n) {
            var i = this;
            return function (r) {
                return _(i, void 0, void 0, function () {
                    var i;
                    return P(this, function (o) {
                        return r.data && r.data.hasOwnProperty("msg") &&
                        r.data.msg.startsWith("Kentico.")
                            ? f.arrayHelper.contains(n, r.origin.toLowerCase())
                                ? [2, this.processIncomingMessage(e, t)(r)]
                                : ((i = (0, p.getService)(m.SERVICE_TYPES.LocalizationService).getLocalization("messaging.forbiddenorigin")), (i = f.stringHelper.format(i, r.origin)), y.logger.logError(i), [2])
                                        : [2];
                                });
                            });
                        };
                    }),
                    (e.prototype.processIncomingMessage = function (e, t) {
                        var n = this;
                        return function (r) {
                            return _(n, void 0, void 0, function () {
                                var n, o;
                                return P(this, function (a) {
                                    switch (a.label) {
                                        case 0:
                                            if (r.data.msg !== m.MessageTypes.SAVE_CONFIGURATION) return [3, 5];
                                            a.label = 1;
                                        case 1:
                                            return a.trys.push([1, 4, , 5]), r.data.contentModified ? [4, (0, l.saveState)(e(), r.data.guid)] : [3, 3];
                                        case 2:
                                            a.sent(), (a.label = 3);
                                        case 3:
                                            return (0, v.postMessage)(m.MessageTypes.CONFIGURATION_STORED, (0, i.default)(e().displayedWidgetVariants), r.origin), [3, 5];
                                        case 4:
                                            return (n = a.sent()), y.logger.logException(n), [3, 5];
                                        case 5:
                                            return (
                                                r.data.msg === m.MessageTypes.LOAD_DISPLAYED_WIDGET_VARIANTS && ((o = JSON.parse(r.data.data) || {}), t((0, h.restoreDisplayedWidgetVariants)(o))),
                                                r.data.msg !== m.MessageTypes.SAVE_TEMP_CONFIGURATION ? [3, 8] : r.data.contentModified ? [4, (0, l.saveState)(e(), r.data.guid)] : [3, 7]
                                            );
                                        case 6:
                                            a.sent(), (a.label = 7);
                                        case 7:
                                            (0, v.postMessage)(m.MessageTypes.TEMP_CONFIGURATION_STORED, null, r.origin), (a.label = 8);
                                        case 8:
                                            return r.data.msg === m.MessageTypes.CONFIRM_RESPONSE && (0, g.handleConfirm)(r.data.result), [2];
                                    }
                                });
                            });
                        };
                    }),
                    (e = w([(0, s.injectable)()], e))
                );
            })();
        t.MessagingService = S;
    }
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.