Problem configuring Bokeh behind proxy

Hi all,

I want to have 4 applications running behind an apache proxy. My config in apache is:

<VirtualHost *:80>

The ServerName directive sets the request scheme, hostname and port that

the server uses to identify itself. This is used when creating

redirection URLs. In the context of virtual hosts, the ServerName

specifies what hostname must appear in the request’s Host: header to

match this virtual host. For the default virtual host (this file) this

value is not decisive as it is used as a last resort host regardless.

However, you must set it for any further virtual host explicitly.

#ServerName www.example.com

ServerAdmin [email protected]
DocumentRoot /var/www/html

Available loglevels: trace8, …, trace1, debug, info, notice, warn,

error, crit, alert, emerg.

It is also possible to configure the loglevel for particular

modules, e.g.

#LogLevel info ssl:warn

ErrorLog {APACHE_LOG_DIR}/error.log CustomLog {APACHE_LOG_DIR}/access.log combined

For most configuration files from conf-available/, which are

enabled or disabled at a global level, it is possible to

include a line for only one particular virtual host. For example the

following line enables the CGI configuration for this host only

after it has been globally disabled with “a2disconf”.

#Include conf-available/serve-cgi-bin.conf

ProxyRequests Off
<Proxy *>
Order deny,allow
#Deny from all
Allow from all
#Allow from 127.0.0.1

ProxyPreserveHost On

ProxyPass /demo1/ws ws://127.0.0.1:5006/demo1/ws
ProxyPassReverse /demo1/ws ws://127.0.0.1:5006/demo1/ws

ProxyPass /demo2/ws ws://127.0.0.1:5006/demo2/ws
ProxyPassReverse /demo2/ws ws://127.0.0.1:5006/demo2/ws

ProxyPass /demo3/ws ws://127.0.0.1:5006/demo3/ws
ProxyPassReverse /demo3/ws ws://127.0.0.1:5006/demo3/ws

ProxyPass /demo4/ws ws://127.0.0.1:5006/demo4/ws
ProxyPassReverse /demo4/ws ws://127.0.0.1:5006/demo4/ws

ProxyPass /demo1 http://127.0.0.1:5006/demo1
ProxyPassReverse /demo1 http://127.0.0.1:5006/demo1

ProxyPass /demo2 http://127.0.0.1:5006/demo2
ProxyPassReverse /demo2 http://127.0.0.1:5006/demo2

ProxyPass /demo3 http://127.0.0.1:5006/demo3
ProxyPassReverse /demo3 http://127.0.0.1:5006/demo3

ProxyPass /demo4 http://127.0.0.1:5006/demo4
ProxyPassReverse /demo4 http://127.0.0.1:5006/demo4

<Directory />
    Require all granted
    Options -Indexes
</Directory>

Alias /static /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/
<Directory /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/>
    # directives to effect the static directory
    Options +Indexes
</Directory>

``

It does not draw anything even when it downloads all the css and js without problem, looking at the html code I think the problem is in this line:

Bokeh.embed.embed_items(docs_json, render_items, “ws://myMachine.private/demo1/ws”);

``

since I don’t see that query in the Apache logs.

Moreover, my problem will be bigger, since the final “production version” will be behind will be behind 3 proxies like:

machineA.public has an Apache server that redirects one of the folders to myMachine.private using machineB.public as a proxy (this is a squid proxy).

I tested this configuration, and it seems the path to the css, js and ws created by bokeh are like http://myMachine.private/… instead of the correct http://machineA.public/folder/… or even ./…

Do you have any ideas on how to solve this problems, both the “simple one”, and then the one with the 3 proxies in the middle. I can partially change the configuration of the proxies, and I would not mind if I have to hardcode the host names or similar in the code to make it works.

Thanks.

Hi, I do not have any specific experience with Apache and Bokeh, but I guess that ws:// url is the websockets connection between the client and server.

Here is an article about how to set that up with Nginx (which I understand is better/faster/easier than many proxy setups with Apache). Maybe it will give you some ideas

https://www.nginx.com/blog/websocket-nginx/

···

On Wed, Nov 23, 2016 at 9:08 AM, [email protected] wrote:

Hi all,

I want to have 4 applications running behind an apache proxy. My config in apache is:

<VirtualHost *:80>

The ServerName directive sets the request scheme, hostname and port that

the server uses to identify itself. This is used when creating

redirection URLs. In the context of virtual hosts, the ServerName

specifies what hostname must appear in the request’s Host: header to

match this virtual host. For the default virtual host (this file) this

value is not decisive as it is used as a last resort host regardless.

However, you must set it for any further virtual host explicitly.

#ServerName www.example.com

ServerAdmin [email protected]
DocumentRoot /var/www/html

Available loglevels: trace8, …, trace1, debug, info, notice, warn,

error, crit, alert, emerg.

It is also possible to configure the loglevel for particular

modules, e.g.

#LogLevel info ssl:warn

ErrorLog {APACHE_LOG_DIR}/error.log CustomLog {APACHE_LOG_DIR}/access.log combined

For most configuration files from conf-available/, which are

enabled or disabled at a global level, it is possible to

include a line for only one particular virtual host. For example the

following line enables the CGI configuration for this host only

after it has been globally disabled with “a2disconf”.

#Include conf-available/serve-cgi-bin.conf

ProxyRequests Off
<Proxy *>
Order deny,allow
#Deny from all
Allow from all
#Allow from 127.0.0.1

ProxyPreserveHost On

ProxyPass /demo1/ws ws://127.0.0.1:5006/demo1/ws
ProxyPassReverse /demo1/ws ws://127.0.0.1:5006/demo1/ws

ProxyPass /demo2/ws ws://127.0.0.1:5006/demo2/ws
ProxyPassReverse /demo2/ws ws://127.0.0.1:5006/demo2/ws

ProxyPass /demo3/ws ws://127.0.0.1:5006/demo3/ws
ProxyPassReverse /demo3/ws ws://127.0.0.1:5006/demo3/ws

ProxyPass /demo4/ws ws://127.0.0.1:5006/demo4/ws
ProxyPassReverse /demo4/ws ws://127.0.0.1:5006/demo4/ws

ProxyPass /demo1 http://127.0.0.1:5006/demo1
ProxyPassReverse /demo1 http://127.0.0.1:5006/demo1

ProxyPass /demo2 http://127.0.0.1:5006/demo2
ProxyPassReverse /demo2 http://127.0.0.1:5006/demo2

ProxyPass /demo3 http://127.0.0.1:5006/demo3
ProxyPassReverse /demo3 http://127.0.0.1:5006/demo3

ProxyPass /demo4 http://127.0.0.1:5006/demo4
ProxyPassReverse /demo4 http://127.0.0.1:5006/demo4

<Directory />
    Require all granted
    Options -Indexes
</Directory>


Alias /static /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/
<Directory /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/>
    # directives to effect the static directory
    Options +Indexes
</Directory>

``

It does not draw anything even when it downloads all the css and js without problem, looking at the html code I think the problem is in this line:

Bokeh.embed.embed_items(docs_json, render_items, “ws://myMachine.private/demo1/ws”);

``

since I don’t see that query in the Apache logs.

Moreover, my problem will be bigger, since the final “production version” will be behind will be behind 3 proxies like:

machineA.public has an Apache server that redirects one of the folders to myMachine.private using machineB.public as a proxy (this is a squid proxy).

I tested this configuration, and it seems the path to the css, js and ws created by bokeh are like http://myMachine.private/.… instead of the correct http://machineA.public/folder/.… or even ./…

Do you have any ideas on how to solve this problems, both the “simple one”, and then the one with the 3 proxies in the middle. I can partially change the configuration of the proxies, and I would not mind if I have to hardcode the host names or similar in the code to make it works.

Thanks.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a23f101c-f757-481d-8163-026db67bc80b%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks,

but I cannot install Ngix, I’m limited to apache.

···

El miércoles, 23 de noviembre de 2016, 21:21:02 (UTC+1), Alex Rice escribió:

Hi, I do not have any specific experience with Apache and Bokeh, but I guess that ws:// url is the websockets connection between the client and server.

Here is an article about how to set that up with Nginx (which I understand is better/faster/easier than many proxy setups with Apache). Maybe it will give you some ideas

https://www.nginx.com/blog/websocket-nginx/

On Wed, Nov 23, 2016 at 9:08 AM, [email protected] wrote:

Hi all,

I want to have 4 applications running behind an apache proxy. My config in apache is:

<VirtualHost *:80>

The ServerName directive sets the request scheme, hostname and port that

the server uses to identify itself. This is used when creating

redirection URLs. In the context of virtual hosts, the ServerName

specifies what hostname must appear in the request’s Host: header to

match this virtual host. For the default virtual host (this file) this

value is not decisive as it is used as a last resort host regardless.

However, you must set it for any further virtual host explicitly.

#ServerName www.example.com

ServerAdmin [email protected]
DocumentRoot /var/www/html

Available loglevels: trace8, …, trace1, debug, info, notice, warn,

error, crit, alert, emerg.

It is also possible to configure the loglevel for particular

modules, e.g.

#LogLevel info ssl:warn

ErrorLog {APACHE_LOG_DIR}/error.log CustomLog {APACHE_LOG_DIR}/access.log combined

For most configuration files from conf-available/, which are

enabled or disabled at a global level, it is possible to

include a line for only one particular virtual host. For example the

following line enables the CGI configuration for this host only

after it has been globally disabled with “a2disconf”.

#Include conf-available/serve-cgi-bin.conf

ProxyRequests Off
<Proxy *>
Order deny,allow
#Deny from all
Allow from all
#Allow from 127.0.0.1

ProxyPreserveHost On

ProxyPass /demo1/ws ws://127.0.0.1:5006/demo1/ws
ProxyPassReverse /demo1/ws ws://127.0.0.1:5006/demo1/ws

ProxyPass /demo2/ws ws://127.0.0.1:5006/demo2/ws
ProxyPassReverse /demo2/ws ws://127.0.0.1:5006/demo2/ws

ProxyPass /demo3/ws ws://127.0.0.1:5006/demo3/ws
ProxyPassReverse /demo3/ws ws://127.0.0.1:5006/demo3/ws

ProxyPass /demo4/ws ws://127.0.0.1:5006/demo4/ws
ProxyPassReverse /demo4/ws ws://127.0.0.1:5006/demo4/ws

ProxyPass /demo1 http://127.0.0.1:5006/demo1
ProxyPassReverse /demo1 http://127.0.0.1:5006/demo1

ProxyPass /demo2 http://127.0.0.1:5006/demo2
ProxyPassReverse /demo2 http://127.0.0.1:5006/demo2

ProxyPass /demo3 http://127.0.0.1:5006/demo3
ProxyPassReverse /demo3 http://127.0.0.1:5006/demo3

ProxyPass /demo4 http://127.0.0.1:5006/demo4
ProxyPassReverse /demo4 http://127.0.0.1:5006/demo4

<Directory />
    Require all granted
    Options -Indexes
</Directory>


Alias /static /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/
<Directory /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/>
    # directives to effect the static directory
    Options +Indexes
</Directory>

``

It does not draw anything even when it downloads all the css and js without problem, looking at the html code I think the problem is in this line:

Bokeh.embed.embed_items(docs_json, render_items, “ws://myMachine.private/demo1/ws”);

``

since I don’t see that query in the Apache logs.

Moreover, my problem will be bigger, since the final “production version” will be behind will be behind 3 proxies like:

machineA.public has an Apache server that redirects one of the folders to myMachine.private using machineB.public as a proxy (this is a squid proxy).

I tested this configuration, and it seems the path to the css, js and ws created by bokeh are like http://myMachine.private/.… instead of the correct http://machineA.public/folder/.… or even ./…

Do you have any ideas on how to solve this problems, both the “simple one”, and then the one with the 3 proxies in the middle. I can partially change the configuration of the proxies, and I would not mind if I have to hardcode the host names or similar in the code to make it works.

Thanks.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a23f101c-f757-481d-8163-026db67bc80b%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I fixed the problen with the proxies by removing this line in the squid proxy:

http_access deny CONNECT !SSL_ports

Nevertheless, I continue having a problem because bokeh use the full path instead of relative paths.

For example, when I’m accessing using
http://machineA.public/demo1/

the paths that bokeh generate are:

and

Bokeh.embed.embed_items(docs_json, render_items, “ws://myMachine.private/demo1/ws”);

it would work like

and

Bokeh.embed.embed_items(docs_json, render_items, “./demo1/ws”);

is there a way to indicate that we want to use relative paths?

using machineB.public

···

El jueves, 24 de noviembre de 2016, 9:13:00 (UTC+1), [email protected] escribió:

Thanks,

but I cannot install Ngix, I’m limited to apache.

El miércoles, 23 de noviembre de 2016, 21:21:02 (UTC+1), Alex Rice escribió:

Hi, I do not have any specific experience with Apache and Bokeh, but I guess that ws:// url is the websockets connection between the client and server.

Here is an article about how to set that up with Nginx (which I understand is better/faster/easier than many proxy setups with Apache). Maybe it will give you some ideas

https://www.nginx.com/blog/websocket-nginx/

On Wed, Nov 23, 2016 at 9:08 AM, [email protected] wrote:

Hi all,

I want to have 4 applications running behind an apache proxy. My config in apache is:

<VirtualHost *:80>

The ServerName directive sets the request scheme, hostname and port that

the server uses to identify itself. This is used when creating

redirection URLs. In the context of virtual hosts, the ServerName

specifies what hostname must appear in the request’s Host: header to

match this virtual host. For the default virtual host (this file) this

value is not decisive as it is used as a last resort host regardless.

However, you must set it for any further virtual host explicitly.

#ServerName www.example.com

ServerAdmin [email protected]
DocumentRoot /var/www/html

Available loglevels: trace8, …, trace1, debug, info, notice, warn,

error, crit, alert, emerg.

It is also possible to configure the loglevel for particular

modules, e.g.

#LogLevel info ssl:warn

ErrorLog {APACHE_LOG_DIR}/error.log CustomLog {APACHE_LOG_DIR}/access.log combined

For most configuration files from conf-available/, which are

enabled or disabled at a global level, it is possible to

include a line for only one particular virtual host. For example the

following line enables the CGI configuration for this host only

after it has been globally disabled with “a2disconf”.

#Include conf-available/serve-cgi-bin.conf

ProxyRequests Off
<Proxy *>
Order deny,allow
#Deny from all
Allow from all
#Allow from 127.0.0.1

ProxyPreserveHost On

ProxyPass /demo1/ws ws://127.0.0.1:5006/demo1/ws
ProxyPassReverse /demo1/ws ws://127.0.0.1:5006/demo1/ws

ProxyPass /demo2/ws ws://127.0.0.1:5006/demo2/ws
ProxyPassReverse /demo2/ws ws://127.0.0.1:5006/demo2/ws

ProxyPass /demo3/ws ws://127.0.0.1:5006/demo3/ws
ProxyPassReverse /demo3/ws ws://127.0.0.1:5006/demo3/ws

ProxyPass /demo4/ws ws://127.0.0.1:5006/demo4/ws
ProxyPassReverse /demo4/ws ws://127.0.0.1:5006/demo4/ws

ProxyPass /demo1 http://127.0.0.1:5006/demo1
ProxyPassReverse /demo1 http://127.0.0.1:5006/demo1

ProxyPass /demo2 http://127.0.0.1:5006/demo2
ProxyPassReverse /demo2 http://127.0.0.1:5006/demo2

ProxyPass /demo3 http://127.0.0.1:5006/demo3
ProxyPassReverse /demo3 http://127.0.0.1:5006/demo3

ProxyPass /demo4 http://127.0.0.1:5006/demo4
ProxyPassReverse /demo4 http://127.0.0.1:5006/demo4

<Directory />
    Require all granted
    Options -Indexes
</Directory>


Alias /static /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/
<Directory /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/>
    # directives to effect the static directory
    Options +Indexes
</Directory>

``

It does not draw anything even when it downloads all the css and js without problem, looking at the html code I think the problem is in this line:

Bokeh.embed.embed_items(docs_json, render_items, “ws://myMachine.private/demo1/ws”);

``

since I don’t see that query in the Apache logs.

Moreover, my problem will be bigger, since the final “production version” will be behind will be behind 3 proxies like:

machineA.public has an Apache server that redirects one of the folders to myMachine.private using machineB.public as a proxy (this is a squid proxy).

I tested this configuration, and it seems the path to the css, js and ws created by bokeh are like http://myMachine.private/.… instead of the correct http://machineA.public/folder/.… or even ./…

Do you have any ideas on how to solve this problems, both the “simple one”, and then the one with the 3 proxies in the middle. I can partially change the configuration of the proxies, and I would not mind if I have to hardcode the host names or similar in the code to make it works.

Thanks.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a23f101c-f757-481d-8163-026db67bc80b%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

You probably need to add the --use-xheaders option to "bokeh serve" as described in this section of the user's guide:

  http://bokeh.pydata.org/en/latest/docs/user_guide/cli.html#network-configuration

And as demonstrated in the code for the active demo.bokehplots.com deployment:

  https://github.com/bokeh/demo.bokehplots.com/blob/8b0de4279d4027f0d9f85d59586fc74d32cbfb5c/bokeh/templates/bokeh-server.conf

This will cause Bokeh to generate resource links from the originating URL (i.e. your public facing Apache instance), instead of the internal bokeh server address.

Additionally, you also need to configure apache to forward x-headers. I'm afraid I don't have any experience with apache that would help with the specifics of that, tho I am reasonably certain that it is possible to do in some way.

Thanks,

Bryan

···

On Nov 24, 2016, at 5:18 AM, [email protected] wrote:

I fixed the problen with the proxies by removing this line in the squid proxy:

http_access deny CONNECT !SSL_ports

Nevertheless, I continue having a problem because bokeh use the full path instead of relative paths.

For example, when I'm accessing using
http://machineA.public/demo1/

the paths that bokeh generate are:

<link rel="stylesheet" href="http://myMachine.private/static/css/bokeh.min.css?v=37ca23e1159701d02b5ad76b701923ee" type="text/css" />
<link rel="stylesheet" href="http://myMachine.private/static/css/bokeh-widgets.min.css?v=522d6173498a389c7f74f0e675195da0" type="text/css" />
        
<script type="text/javascript" src="http://myMachine.private/static/js/bokeh.min.js?v=02fddade3bff4696b3d503d8bd2cfb4e"></script>
<script type="text/javascript" src="http://myMachine.private/static/js/bokeh-widgets.min.js?v=9d3c470f785d5eb98e1d61ca747ac66a"></script>
<script type="text/javascript" src="http://myMachine.private/static/js/bokeh-compiler.min.js?v=2bf5ae368fd7ad3e827391b3be1e100c"></script>

and

Bokeh.embed.embed_items(docs_json, render_items, "ws://myMachine.private/demo1/ws");

it would work like

<link rel="stylesheet" href="./static/css/bokeh.min.css?v=37ca23e1159701d02b5ad76b701923ee" type="text/css" />
<link rel="stylesheet" href="./static/css/bokeh-widgets.min.css?v=522d6173498a389c7f74f0e675195da0" type="text/css" />
        
<script type="text/javascript" src="./static/js/bokeh.min.js?v=02fddade3bff4696b3d503d8bd2cfb4e"></script>
<script type="text/javascript" src="./static/js/bokeh-widgets.min.js?v=9d3c470f785d5eb98e1d61ca747ac66a"></script>
<script type="text/javascript" src="./static/js/bokeh-compiler.min.js?v=2bf5ae368fd7ad3e827391b3be1e100c"></script>

and

Bokeh.embed.embed_items(docs_json, render_items, "./demo1/ws");

is there a way to indicate that we want to use relative paths?

using machineB.public

El jueves, 24 de noviembre de 2016, 9:13:00 (UTC+1), [email protected] escribió:
Thanks,

but I cannot install Ngix, I'm limited to apache.

El miércoles, 23 de noviembre de 2016, 21:21:02 (UTC+1), Alex Rice escribió:
Hi, I do not have any specific experience with Apache and Bokeh, but I guess that ws:// url is the websockets connection between the client and server.

Here is an article about how to set that up with Nginx (which I understand is better/faster/easier than many proxy setups with Apache). Maybe it will give you some ideas

https://www.nginx.com/blog/websocket-nginx/

On Wed, Nov 23, 2016 at 9:08 AM, <[email protected]> wrote:
Hi all,

I want to have 4 applications running behind an apache proxy. My config in apache is:

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin [email protected]
DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog \{APACHE\_LOG\_DIR\}/error\.log CustomLog {APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

ProxyRequests Off
<Proxy *>
    Order deny,allow
    #Deny from all
    Allow from all
    #Allow from 127.0.0.1
</Proxy>
ProxyPreserveHost On

ProxyPass /demo1/ws ws://127.0.0.1:5006/demo1/ws
ProxyPassReverse /demo1/ws ws://127.0.0.1:5006/demo1/ws

ProxyPass /demo2/ws ws://127.0.0.1:5006/demo2/ws
ProxyPassReverse /demo2/ws ws://127.0.0.1:5006/demo2/ws

ProxyPass /demo3/ws ws://127.0.0.1:5006/demo3/ws
ProxyPassReverse /demo3/ws ws://127.0.0.1:5006/demo3/ws

ProxyPass /demo4/ws ws://127.0.0.1:5006/demo4/ws
ProxyPassReverse /demo4/ws ws://127.0.0.1:5006/demo4/ws

ProxyPass /demo1 http://127.0.0.1:5006/demo1
ProxyPassReverse /demo1 http://127.0.0.1:5006/demo1

ProxyPass /demo2 http://127.0.0.1:5006/demo2
ProxyPassReverse /demo2 http://127.0.0.1:5006/demo2

ProxyPass /demo3 http://127.0.0.1:5006/demo3
ProxyPassReverse /demo3 http://127.0.0.1:5006/demo3

ProxyPass /demo4 http://127.0.0.1:5006/demo4
ProxyPassReverse /demo4 http://127.0.0.1:5006/demo4

    <Directory />
        Require all granted
        Options -Indexes
    </Directory>

    Alias /static /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/
    <Directory /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/>
        # directives to effect the static directory
        Options +Indexes
    </Directory>

</VirtualHost>

It does not draw anything even when it downloads all the css and js without problem, looking at the html code I think the problem is in this line:

Bokeh.embed.embed_items(docs_json, render_items, "ws://myMachine.private/demo1/ws");

since I don't see that query in the Apache logs.

Moreover, my problem will be bigger, since the final "production version" will be behind will be behind 3 proxies like:
machineA.public has an Apache server that redirects one of the folders to myMachine.private using machineB.public as a proxy (this is a squid proxy).

I tested this configuration, and it seems the path to the css, js and ws created by bokeh are like http://myMachine.private/... instead of the correct http://machineA.public/folder/... or even ./...

Do you have any ideas on how to solve this problems, both the "simple one", and then the one with the 3 proxies in the middle. I can partially change the configuration of the proxies, and I would not mind if I have to hardcode the host names or similar in the code to make it works.

Thanks.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a23f101c-f757-481d-8163-026db67bc80b%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9bd1da58-b1d0-4555-bf4f-76b88a11656b%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Even with the --use-xheaders it generates the links wrongly.

Right now I’m executing it like:

bokeh serve demo1/ demo2/ demo3/ demo4/ --host myMachine.private --use-xheaders

If I remove the “–host” headers the server reject the connection because:

Rejected connection from host ‘myMachine.private’ because it is not in the --host whitelist

I capture the traffic that arrives to the tornado server. And the query is like:

GET /demo1 HTTP/1.1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Upgrade-Insecure-Requests: 1
If-None-Match: “5825ad49e634ce9b7220e65a07bd55ac11963571-gzip”
X-Forwarded-Host: machineA.public
X-Forwarded-Server: machineA.public
Host: myMachine.private
Via: 1.1 localhost (squid/3.1.20)
X-Forwarded-For: publicIP1, publicIP2
Cache-Control: max-age=259200
Connection: keep-alive

Any idea??

Thanks.

···

El domingo, 27 de noviembre de 2016, 21:51:13 (UTC+1), Bryan Van de ven escribió:

Hi,

You probably need to add the --use-xheaders option to “bokeh serve” as described in this section of the user’s guide:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/cli.html#network-configuration](http://bokeh.pydata.org/en/latest/docs/user_guide/cli.html#network-configuration)

And as demonstrated in the code for the active demo.bokehplots.com deployment:

    [https://github.com/bokeh/demo.bokehplots.com/blob/8b0de4279d4027f0d9f85d59586fc74d32cbfb5c/bokeh/templates/bokeh-server.conf](https://github.com/bokeh/demo.bokehplots.com/blob/8b0de4279d4027f0d9f85d59586fc74d32cbfb5c/bokeh/templates/bokeh-server.conf)

This will cause Bokeh to generate resource links from the originating URL (i.e. your public facing Apache instance), instead of the internal bokeh server address.

Additionally, you also need to configure apache to forward x-headers. I’m afraid I don’t have any experience with apache that would help with the specifics of that, tho I am reasonably certain that it is possible to do in some way.

Thanks,

Bryan

On Nov 24, 2016, at 5:18 AM, [email protected] wrote:

I fixed the problen with the proxies by removing this line in the squid proxy:

http_access deny CONNECT !SSL_ports

Nevertheless, I continue having a problem because bokeh use the full path instead of relative paths.

For example, when I’m accessing using
http://machineA.public/demo1/

the paths that bokeh generate are:

and

Bokeh.embed.embed_items(docs_json, render_items, “ws://myMachine.private/demo1/ws”);

it would work like

and

Bokeh.embed.embed_items(docs_json, render_items, “./demo1/ws”);

is there a way to indicate that we want to use relative paths?

using machineB.public

El jueves, 24 de noviembre de 2016, 9:13:00 (UTC+1), [email protected] escribió:

Thanks,

but I cannot install Ngix, I’m limited to apache.

El miércoles, 23 de noviembre de 2016, 21:21:02 (UTC+1), Alex Rice escribió:

Hi, I do not have any specific experience with Apache and Bokeh, but I guess that ws:// url is the websockets connection between the client and server.

Here is an article about how to set that up with Nginx (which I understand is better/faster/easier than many proxy setups with Apache). Maybe it will give you some ideas

https://www.nginx.com/blog/websocket-nginx/

On Wed, Nov 23, 2016 at 9:08 AM, [email protected] wrote:

Hi all,

I want to have 4 applications running behind an apache proxy. My config in apache is:

<VirtualHost *:80>

The ServerName directive sets the request scheme, hostname and port that

the server uses to identify itself. This is used when creating

redirection URLs. In the context of virtual hosts, the ServerName

specifies what hostname must appear in the request’s Host: header to

match this virtual host. For the default virtual host (this file) this

value is not decisive as it is used as a last resort host regardless.

However, you must set it for any further virtual host explicitly.

#ServerName www.example.com

ServerAdmin [email protected]

DocumentRoot /var/www/html

Available loglevels: trace8, …, trace1, debug, info, notice, warn,

error, crit, alert, emerg.

It is also possible to configure the loglevel for particular

modules, e.g.

#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

For most configuration files from conf-available/, which are

enabled or disabled at a global level, it is possible to

include a line for only one particular virtual host. For example the

following line enables the CGI configuration for this host only

after it has been globally disabled with “a2disconf”.

#Include conf-available/serve-cgi-bin.conf

ProxyRequests Off

<Proxy *>

Order deny,allow
#Deny from all
Allow from all
#Allow from 127.0.0.1

ProxyPreserveHost On

ProxyPass /demo1/ws ws://127.0.0.1:5006/demo1/ws

ProxyPassReverse /demo1/ws ws://127.0.0.1:5006/demo1/ws

ProxyPass /demo2/ws ws://127.0.0.1:5006/demo2/ws

ProxyPassReverse /demo2/ws ws://127.0.0.1:5006/demo2/ws

ProxyPass /demo3/ws ws://127.0.0.1:5006/demo3/ws

ProxyPassReverse /demo3/ws ws://127.0.0.1:5006/demo3/ws

ProxyPass /demo4/ws ws://127.0.0.1:5006/demo4/ws

ProxyPassReverse /demo4/ws ws://127.0.0.1:5006/demo4/ws

ProxyPass /demo1 http://127.0.0.1:5006/demo1

ProxyPassReverse /demo1 http://127.0.0.1:5006/demo1

ProxyPass /demo2 http://127.0.0.1:5006/demo2

ProxyPassReverse /demo2 http://127.0.0.1:5006/demo2

ProxyPass /demo3 http://127.0.0.1:5006/demo3

ProxyPassReverse /demo3 http://127.0.0.1:5006/demo3

ProxyPass /demo4 http://127.0.0.1:5006/demo4

ProxyPassReverse /demo4 http://127.0.0.1:5006/demo4

<Directory />
    Require all granted
    Options -Indexes
</Directory>
Alias /static /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/
<Directory /root/.virtualenvs/scipy/lib/python2.7/site-packages/bokeh/server/static/>
    # directives to effect the static directory
    Options +Indexes
</Directory>

It does not draw anything even when it downloads all the css and js without problem, looking at the html code I think the problem is in this line:

Bokeh.embed.embed_items(docs_json, render_items, “ws://myMachine.private/demo1/ws”);

since I don’t see that query in the Apache logs.

Moreover, my problem will be bigger, since the final “production version” will be behind will be behind 3 proxies like:

machineA.public has an Apache server that redirects one of the folders to myMachine.private using machineB.public as a proxy (this is a squid proxy).

I tested this configuration, and it seems the path to the css, js and ws created by bokeh are like http://myMachine.private/.… instead of the correct http://machineA.public/folder/.… or even ./…

Do you have any ideas on how to solve this problems, both the “simple one”, and then the one with the 3 proxies in the middle. I can partially change the configuration of the proxies, and I would not mind if I have to hardcode the host names or similar in the code to make it works.

Thanks.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a23f101c-f757-481d-8163-026db67bc80b%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to bo[email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9bd1da58-b1d0-4555-bf4f-76b88a11656b%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.