Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle assets and requests_pathname_prefix #489

Open
boludo00 opened this issue Dec 11, 2018 · 3 comments
Open

handle assets and requests_pathname_prefix #489

boludo00 opened this issue Dec 11, 2018 · 3 comments
Labels
feature something new P3 backlog

Comments

@boludo00
Copy link

So I currently have an API Gateway serving my Dash app under the /dev/ base path.
I have specified my Dash.dash app with

app.config.update({
    # as the proxy server will remove the prefix
    "routes_pathname_prefix": "/", 
    # the front-end will prefix this string to the requests
    # that are made to the proxy server
    'requests_pathname_prefix': '/dev/'
})

and most the app renders fine however, I noticed that the files in my assets directory are not being found since when the app loads, its looking in /assets/ instead of /dev/assets.

This seems like a quick fix on my part, but I'm not sure where to start since this library is so new to me.

@T4rk1n
Copy link
Contributor

T4rk1n commented Dec 12, 2018

Have routes and requests the same value /dev/, in your gateway you can proxy to host/dev/ instead of just host/.

@T4rk1n
Copy link
Contributor

T4rk1n commented Jan 23, 2019

@boludo00 Can you try dash version 0.35.3 and see if it fixes your issue ?

@oskardcmn
Copy link

I stumbled over the same (or similar) issue with dash=1.0.1. My app is served under host.com/apps/appname/. By setting

app.config.update({
    "routes_pathname_prefix": '', 
    'requests_pathname_prefix': ''
})

all internal assets are served fine (aka relatively to the dash app page's location).

<script src="_dash-component-suites/dash_renderer/dash_renderer.min.js?v=1.0.0&amp;m=1564659726"></script>

But the files automatically served via the assets/ folder mechanism are not found (404), since their href is set to an absolute location.

<link rel="icon" type="image/x-icon" href="/assets/favicon.ico?m=1564567628.0714939">
<link rel="stylesheet" href="/assets/globalloading.css?m=1564567628.0714939">

Setting assets_url_path='assets' does not help, as the slash is always added as prefix.

A similar observation was made here: https://community.plot.ly/t/assets-folder-not-found-in-docker/14673/8

@gvwilson gvwilson self-assigned this Jul 17, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added the P3 backlog label Aug 13, 2024
@gvwilson gvwilson changed the title assets and requests_pathname_prefix handle assets and requests_pathname_prefix Aug 13, 2024
@gvwilson gvwilson added the feature something new label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
Development

No branches or pull requests

4 participants