502 Proxy Error with Dash

Dear all,

I am trying to deploy a Dash application that is running smoothly locally. To do so, I installed and configured Python3 on the server side, clone my code there, and configured Apache with the following:

<VirtualHost *:80>
    serverName sub.example.com

    ProxyPass        / http://127.0.0.1:8050
    ProxyPassReverse / http://127.0.0.1:8050
    ProxyRequests Off

    <Proxy http://localhost:8050/*>
           Order deny,allow
           Allow from all
    </Proxy>
</VirtualHost>

When I try to access http://sub.example.com I get an Error loading layout. I cannot see nothing more (no message, nothing) in my console. If I take a look on the dev console on my browser, I get the following errors:

GET XHR http://sub.example.com/_dash-layout [HTTP/1.1 502 Proxy Error 18ms]
GET XHR http://sub.example.com/_dash-dependencies [HTTP/1.1 502 Proxy Error 18ms]

I have no idea (and found no inspiration online) of what I could do to circumvent this issue. I suspect it has something to do with my Apache configuration, but that’s it.

Any help or hint would be appreciated!

Edit:
I found some potential hints on this post but I am not sure to understand how to apply this to my case.

Are you able to check the request logs of the actual Apache requests? This looks like an error on the proxy side rather than the Dash side, but we may be able to learn something from looking at what the requests look like before they reach Dash.


Also, see http://flask.pocoo.org/docs/0.12/deploying/mod_wsgi/ for some instructions on using apache with flask. I don’t have any experience with this personally.

Thanks for helping! I can access the log and get the following:

[Mon Oct 16 16:59:52.821276 2017] [proxy:error] [pid 6193] [client 90.88.142.181:51638] AH00898: DNS lookup failure for: 127.0.0.1:8050_dash-layout returned by /_dash-layout, referer: http://sub.example.com

It is definitely a problem on the proxy/server side rather than a Dash one, I’ll have a look on the material you provide on Flask.

It looks like there is a missing / here, it should be 127.0.0.1:8050/_dash-layout. What if you changed your settings to be

    ProxyPass        / http://127.0.0.1:8050/
    ProxyPassReverse / http://127.0.0.1:8050/

?

Indeed… I had other problems previously and edited these two lines to remove the trailing slash according to something else I found. It works now like a charm, thanks!

1 Like