tensorflow / tensorboard

TensorFlow's Visualization Toolkit
Apache License 2.0
6.71k stars 1.66k forks source link

Profile plugin does not respect --path_prefix when serving trace_viewer_index.html #2263

Closed mmourafiq closed 5 years ago

mmourafiq commented 5 years ago

Issue description

Running tensorboard behind an nginx reverse proxy serves all assets, visualizations, graphs, ..., Unfortunately the tensorboard does not add --path_prefix when serving the trace viewer. So an errors occurs for: http://localhost:8000/trace_viewer_index.html?trace_data_url=/data/plugin/profile/data?host=local.&run=2019-05-21_17-53-18&tag=trace_viewer&is_streaming=false

Adding the path_prefix to this url fixes the issue, so I assume that this plugin is not using same mechanism for loading assets.

mmourafiq commented 5 years ago

To reproduce, you don't need to set a reverse proxy, you can just start tensorboard with a --path_prefix, all tabs should work but the profile/trace_viewer.

nfelt commented 5 years ago

@qiuminxu could you take a look when you get a chance?

qiuminxu commented 5 years ago

Sure @nfelt, can you point to me how does "--path_prefix" work for other plugins?

nfelt commented 5 years ago

In the process of remembering how to test path_prefix I realized it was a pretty simple fix so I just put together a PR here: https://github.com/tensorflow/tensorboard/pull/2276

For future reference, the --path_prefix flag is just used for cases when TensorBoard isn't running at the root path on the webserver - so instead of "http://myserver.com/index.html" for the main tensorboard page, it's something like "http://myserver.com/mypath/index.html". In that case, when running TensorBoard, you'd pass --path_prefix=/mypath/ to indicate to TensorBoard the path it's serving under.

To test this behavior you can just run nginx in front of TensorBoard, as indicated in my PR description.