_dash_update_component 403 with basic_auth safari


Perhaps related to Dash-auth causes other pages served by the flask server to 403, I’ve been getting 403 errors (“Failed to load resource: the server responded with a status of 403 (FORBIDDEN)”) showing up in Safari’s console and components are not updating after dcc.interval fires two or three times. What’s confounding is that the page works in Chrome Canary and even works in Safari when basic_auth is commented out. The page is also loading correctly on both startup and page reload-- the components are just not updating on dcc.interval firing after one or two boops separated by ten seconds. Also trying on IE later today and will report back.

Two dcc.intervals are firing-- one is connected to the metrics I’m monitoring. The interval is far less frequent for the latter especially during this testing period. Some setup details (whole app is 450 lines at the moment and growing fast since I’m really digging Dash!)-- the timestamp is what I’m using to monitor dcc.intervals firing and it’s wired to an html.H5(id=“timestamp”).

# App Setup

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

CACHE_CONFIG = {"CACHE_TYPE": "redis", "CACHE_REDIS_URL": os.environ.get("REDIS_URL")}

cache = Cache()

cache.init_app(app.server, config=CACHE_CONFIG)

server = app.server

server.secret_key = os.environ.get('SECRET_KEY', 'boop')

auth = dash_auth.BasicAuth(app, VALID_USERNAME_PASSWORD_PAIRS) 


# Timestamp Setup
    Output("timestamp", "children"),
    events=[Event("timestamp-interval-component", "interval")],
def update_timestamp():
    utc_now = pytz.utc.localize(datetime.datetime.utcnow())
    pst_now = utc_now.astimezone(pytz.timezone("America/Los_Angeles"))
    timestr = pst_now.strftime("%c")
    children = f"Applications as of {timestr} PT"
    return children

Just noting here that this seems to be a Safari-only issue. Chrome, IE, and Firefox all work as expected. Thanks for any insights anyone might be able to share!