rstudio / leaflet

R Interface to Leaflet Maps
http://rstudio.github.io/leaflet/
Other
798 stars 507 forks source link

leaflet map dose not load map and render behind proxy #240

Open zhuobao opened 8 years ago

zhuobao commented 8 years ago

Hi, I am using Rstudio and shiny to build a map using leaflet. I configured http_proxy, https_proxy and ftp_proxy. download.file works, But leaflet map does not (in the viewer window of rstudio), it does not download map pictures and does not render. while in the web browser, through the browser proxy settings. leaflet downloads and renders.

Could you please make leaflet using R's proxy when displaying in rstudio?

jcheng5 commented 8 years ago

@jjallaire, @jmcphers, do you know if RStudio's viewer pane respects any proxy settings?

jmcphers commented 8 years ago

I don't think so -- probably Qt is making the network requests directly, and IIRC our QtWebView doesn't use a proxy and isn't user-configurable to do so (see https://github.com/rstudio/rstudio/blob/53e10c4f0f5a8b04ef1d80073f769cf69f948c22/src/cpp/desktop/DesktopNetworkAccessManager.cpp#L32 and https://github.com/rstudio/rstudio/blob/53e10c4f0f5a8b04ef1d80073f769cf69f948c22/src/cpp/desktop/DesktopSessionLauncher.cpp#L114-L120).

I'll open an issue in RStudio to track this.

VeilleData commented 8 years ago

Same issue here. How can one deal with this issue in the meanwhile ?

colemanrob commented 8 years ago

Same issue.

brendanhoganvt commented 7 years ago

In the meantime, a workaround is to click the button to "Show in new window" (i.e. to open it in the browser instead of the RStudio viewer panel).

brendanhoganvt commented 7 years ago

@jmcphers Could you link to the issue in RStudio so we can follow that? I had trouble locating it just now. For what it's worth, this only seems to be an issue for me in the RStudio Desktop. When I'm running RStudio Server (with the same proxies), it is fine.

jmcphers commented 7 years ago

We don't currently have a public facing issue tracker for RStudio, but I've added a link to this github issue in the internal tracker (we'll update this thread when we have a fix).

jcheng5 commented 7 years ago

@jmcphers FYI, RStudio does attempt to use the system proxy. See:

When I dealt with similar issues on Windows Live Writer, it was often the case that networking code that didn't use Windows' built-in HTTP APIs would have to try to duplicate Windows' own proxy settings. This would work if the proxy was a simple hostname/port, but some corporate settings would have more complicated settings, including JScript scripts that could execute arbitrary logic to map a hostname to a proxy host/port, and those cases at a minimum would fail. I don't know if these cases are that, or just a bug in the way I implemented the dynamic proxy code.

jmcphers commented 7 years ago

The proxy factory does invoke the system proxy, but as far as I can tell we don't actually use the proxy factory any more; the only place the proxy factory is referenced in the code today is in this comment.

https://github.com/rstudio/rstudio/blob/54cd3abcfc58837b433464c793fe9b03a87f0bb4/src/cpp/desktop/DesktopSessionLauncher.cpp#L114-L120

Possibly I'm missing an inferred usage? I've added your notes to the bug tracking this on the RStudio side and bumped it for consideration in our upcoming patch release (will probably bug you when we take a look at look at it to get your perspective!).

jcheng5 commented 7 years ago

@jmcphers Nice catch! That would explain it! (probably)

jmcphers commented 7 years ago

We have a new RStudio preview out today that has a fix intended to address this issue. Would one of you affected by the issue be willing to give it a test drive to see if it resolves your problem? @zhuobao @VeilleData @colemanrob

https://www.rstudio.com/products/rstudio/download/preview/

Xytreyum commented 7 years ago

@jmcphers It did work for me! Thanks for this update (but updated from 0.99.xx).

brendanhoganvt commented 7 years ago

For what it's worth, I just ran into this again in RStudio Desktop Version 1.0.136, on windows behind a proxy. If I open the Viewer in a new window, it displays fine. But within the RStudio viewer window in the lower right corner, it shows nothing but a gray background.

In RStudio Server Version 1.0.44, on linux behind the same proxy, the viewer preview window is fine.

hugh1li commented 6 years ago

I am not using any proxy. But I still cannot use leaflet. Viewer (or zoom) is blank, browser says "cannot find local host". Here is my sessioninfo().

sessionInfo() R version 3.4.2 (2017-09-28) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS High Sierra 10.13.1

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods
[7] base

other attached packages: [1] leaflet_1.1.0.9000 forcats_0.2.0 stringr_1.2.0
[4] dplyr_0.7.4 purrr_0.2.4 readr_1.1.1
[7] tidyr_0.7.2 tibble_1.3.4 ggplot2_2.2.1
[10] tidyverse_1.2.1

loaded via a namespace (and not attached): [1] reshape2_1.4.2 haven_1.1.0 lattice_0.20-35 [4] colorspace_1.3-2 htmltools_0.3.6 yaml_2.1.14
[7] rlang_0.1.4 foreign_0.8-69 glue_1.2.0
[10] modelr_0.1.1 readxl_1.0.0 bindrcpp_0.2
[13] bindr_0.1 plyr_1.8.4 munsell_0.4.3
[16] gtable_0.2.0 cellranger_1.1.0 rvest_0.3.2
[19] htmlwidgets_0.9 psych_1.7.8 httpuv_1.3.5
[22] crosstalk_1.0.0 parallel_3.4.2 broom_0.4.3
[25] Rcpp_0.12.14 xtable_1.8-2 scales_0.5.0
[28] jsonlite_1.5 mime_0.5 mnormt_1.5-5
[31] hms_0.4.0 digest_0.6.12 stringi_1.1.6
[34] shiny_1.0.5 grid_3.4.2 cli_1.0.0
[37] tools_3.4.2 magrittr_1.5 lazyeval_0.2.1
[40] crayon_1.3.4 pkgconfig_2.0.1 xml2_1.1.1
[43] lubridate_1.7.1 rstudioapi_0.7 assertthat_0.2.0 [46] httr_1.3.1 R6_2.2.2 nlme_3.1-131
[49] compiler_3.4.2

markusdumke commented 6 years ago

I have the same? problem. Leaflet map is not rendered in the RStudio Viewer Pane, the map is just grey. I am using RStudio 1.1.383 and this is the sessionInfo:

R version 3.4.2 (2017-09-28) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_Germany.1252 LC_CTYPE=English_Germany.1252
[3] LC_MONETARY=English_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=English_Germany.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] leaflet_1.1.0.9000

loaded via a namespace (and not attached): [1] htmlwidgets_0.9 shiny_1.0.5 compiler_3.4.2 magrittr_1.5 R6_2.2.2
[6] htmltools_0.3.6 tools_3.4.2 yaml_2.1.14 Rcpp_0.12.13 crosstalk_1.0.0 [11] jsonlite_1.5 digest_0.6.12 xtable_1.8-2 httpuv_1.3.5 mime_0.5

natereal commented 2 years ago

Was a resolution to this ever found? I am using the latest R Studio version but I am still having this identical problem. I can't say for sure that it's the exact same, but it looks likely. I am using a proxy in a work environment, and everything works as expected except for the addTiles() layer of leaflet, when using the Viewer pane

To add to this, I am using a proxy in a corporate setting which has a username/password component (not just host/port).