Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

How to add additional Header to all Requests (or at least to a Button)?

Hi,

I want to run a Dash application on a platform that - for security reasons - wants me to send an additional Header with each request made by Dash (such as clicking on a Button).

Technically the platform sets a cookie and wants me to send the content of the cookie in the request header.

Unfortunately I did not find any Example how to do this with Dash (or Flask or React.js).

Thanks in Advance
Hans

This isn’t possible right now but we’re planning on adding support for this. This issue in particular has been sponsored by an organization, so we are looking at getting it in by around September. You can follow the progress here: https://github.com/plotly/dash-renderer/issues/65

I have a similar requirement - now that this feature has been merged are there any examples demonstrating how to achieve this? From what I understand I will need to do something along the lines of:

app.renderer = """
var renderer = new DashRenderer({
    request_pre: (payload) => {
        // some code here to set header
        console.log(payload);
    },
})
"""