CORS error for dash webapp on automation node while accessing font files stored on design node.

Options
manju
manju Registered Posts: 1

Hi,

We have built a dash webapp and use some custom fonts which are stored on the design node. After deploying it on the automation node and accessing the automation node url for the webapp, it is not able to display the custom fonts because of the cross origin resource sharing error (CORS).

How can we enable this for our dash webapp? (We tried using the flask-cors library but did not work).

Thanks,
Manju

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,737 Neuron
    Options

    You need to deploy the same custom fonts in the automation node. Repeat the same exact steps you did in your designer node in the automation node.

  • manju1
    manju1 Registered Posts: 2
    Options

    Thanks for replying @Turribeach
    .

    For the webapp on the design node, we added our font files in the static files directory on the design node. We are not able to do the same for automation node as we were told by our support team that they cannot upload anything manually on the automation node.

    The webapp on the automation node is not able to access the custom fonts as they are on the design node domain, hence giving the CORS error.

    I've been reading about adding the header 'Access-Control-Allow-Origin' in the web server config file to allow cross origin resource sharing. But also wanted to understand if there's anything else which can be done.

    Thanks & Regards,

    Manju

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,737 Neuron
    Options

    Hi, Dataiku does not provide any facility to upload static files to the Automation node, so this is something you will need to take care yourself. If your support team does not allow you to upload them manually or they don't want to do any manual steps then you will need to develop an automated way of doing it. There is no other way. You could develp an "Admin" Web App which could have a Dataiku folder which maps to the static folder you use for static images on your other web apps so you could use this Webapp. In fact there is an even an example on the Developer site on how to upload files with Managed Folders in Dash which you could use:

    https://developer.dataiku.com/latest/tutorials/webapps/dash/upload-download-files/index.html

    Once you have this admin webapp you could easily use it to move static files manually from Design to Automation. There is a million other ways you could solve this deployment issue. What you certainly shouldn't do is to mess with the Access-Control-Allow-Origin header which will be basically a dirty hack. The last thing you want is for your Automation webapps to depend on your Design node. Things that run on Automation should not depend on the Designer node. Imagine what happens if you delete or change a static image in your Designer node, the change will be reflected on the Automation node without a release, not a good model...

  • manju1
    manju1 Registered Posts: 2
    Options

    Thanks @Turribeach
    .

    Will explore the Managed Folders route. Appreciate your help.

Setup Info
    Tags
      Help me…