Proxy/Routing difficulties on Dash Deployment

hi! I would appreciate it if I could receive some help in managing the prefix for deploying an instance of the Dash app.

I have an instance of a Dash application successfully running on a certain 192.168.x.y:7050 and am trying to route it through another server on the same network that has a static IP binding to a URL: url

I intend to deploy the application to url/my-app/

The environment configurations are:

$  pip freeze | grep dash
dash==0.38.0
dash-bootstrap-components==0.3.4
dash-core-components==0.43.1
dash-html-components==0.13.5
dash-renderer==0.19.0
dash-table==3.5.0

The /etc/apache2/httpd.conf configuration is as follows:

ProxyPass /my-app/ http://192.168..x.y:7050/
ProxyPassReverse /my-app/ http://192.168..x.y:7050/
ProxyPassReverseCookiePath /my-app/ /my-app/

The current Dash configuration that I attempted for prefixing with /my-app/ given instructions from @chriddyp’s reply (Deploy Dash on apache server [solved!] - #18 by chriddyp) is:

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP], static_folder='static')
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
app.config.update({
                'requests_pathname_prefix': '/my-app/',
                'routes_pathname_prefix': '/'
                })

server = app.server
app.config.suppress_callback_exceptions = True

but this results in the otherwise functional 192.168.x.y:7050 give a bunch of Uncaught SyntaxError: Unexpected token < errors as seen below

on the other hand, url/my-app/ gives a 404:

This is similar to the error I receive when I attempt the fix provided by @marugari in the same thread (Deploy Dash on apache server [solved!] - #14 by marugari)

I also attempted other permutations of the pathname prefix to no avail. These include permutations between ‘’, ‘/’, and '/my-app/’ for both requests and routes.

Any response / help on this end will be much appreciated. Happy to provide any more details.

1 Like

was able to successfully solve the problem in a somewhat hacky manner; I appended /my-app/ to all routes and paths throughout the code base and used the following configuration on Dash

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP], static_folder='static', url_base_pathname='/my-app/')
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True

Additionally, I changed the /etc/apache2/httpd.conf configuration as follows:

ProxyPass /my-app/ http://192.168..x.y:7050/my-app/ 
ProxyPassReverse /my-app/ http://192.168..x.y:7050/my-app/ 
ProxyPassReverseCookiePath /my-app/ /my-app/

Hope this helps somebody!

3 Likes

Yes. Helped my use case. Thanks a lot