Using more than one domain name in Add-On Descriptor?

I have a project where the front end is a single page application hosted on a CDN and the backend is hosted on Heroku. They use different domain names.

The issue is with the Add-On descriptor: I can describe a single baseUrl that gets used for all of the relative URLs in the rest of the file. However, I’d like to route the /installed lifecycle notification to the backend, and all of the module urls to the SPA on the CDN.

To illustrate:

{
  "modules": {
    "dialogs": [
      {
        "url": "/SOME-FRONT-END-URL-ON-CDN",
        "options": {
          "size": "fullscreen",
          "header": {
            "value": "Example Dialog"
          }
        },
        "key": "some-dialog-key"
      }
    ]
  },
  "lifecycle": {
    "installed": "/installed-URL-ON-BACKEND",
  },
  "baseUrl": "http://www.URL-FOR-CDN.com"
}

Anyone run into this issue before?

Constantly :frowning: Unfortunately there can only be one base url. https://ecosystem.atlassian.net/browse/AC-1358

My suggestion would be to send everything through the CDN and just specify it to be pass through for the server specific calls.

I should also point out that since the dialog content will be jwt protected, the cdn can’t really cache things for you so it’s probably not going to gain you much ( a realization I’ve made after putting the above issue in).

Good thinking. Mind if I ask how you were able to accomplish this? I tried using surge.sh but the closest I could come was using their 301 redirects which do not preserve any POST data (e.g. for the /installed notification)

Ah, good point.

Me too. Found the following approach a good compromise: https://m.alphasights.com/using-nginx-on-heroku-to-serve-single-page-apps-and-avoid-cors-5d013b171a45, and asked Atlassian for small fix in atlassian-connect-express: https://bitbucket.org/atlassian/atlassian-connect-express/pull-requests/125/really-skip-qsh-verification-in/diff