Open ralmond opened 4 years ago
Connecting this to https://github.com/rstudio/shiny-server/issues/429. I think it's likely that this is an issue with your proxy configuration.
Thank you for linking, yes the are the same problem. However, if I'm understanding how Shiny and Shiny server interact, then the problem is in fact in the R code in the shiny package and not the node.js code in shiny server.
For the record, when I run without the proxy, I get:
Loading failed for the <script> with source “http://localhost:3838/IntroStats/shared/json2-min.js”.
If I understand what is happening correcting in resourcePathHandler, then on line 176 of server.R, the line:
match <- regexpr('^/([^/]+)/', path, perl=TRUE)
Might be the issue. If path
is "/shared/json2-min.js", then match
will be "shared" and the resource will be found, but if path
is "/IntroStats/shared/json2-min.js" thenmatch
will be "IntroStats" and the resource won't be found.
I'm thinking that changing
match <- regexpr('^.*/([^/]+)/', path, perl=TRUE)
might skip over any subdirectories. If this sounds right, I can give it a try.
Can you provide a minimal Rmd that produces the problem?
Untitled.Rmd.txt Note 1: It is deployed on my server as https://pluto.coe.fsu.edu/rdemos/IntroStats/Untitled.Rmd So you can see the html error messages.
Note 2:
This is just the default Rmd that RStudio generates. The issue is what directory it is placed in on the server and not the Rmd code.
I'm having difficulty serving Rmd files when the file is placed in a subdirectory rather than the main directory of the server. The problem seems to be that the javascript and other resources (e.g.,
shiny.min.js
) are not being loaded (returning 404 errors) and thus the page won't run.Thus: https://pluto.coe.fsu.edu/rdemos/NormalCalculator.Rmd works fine, but https://pluto.coe.fsu.edu/IntroStats/Correlation.Rmd does not.
System details
RHEL 7.5, Apache 2.4.6 I'm redirecting the rdemos URL to shiny with Apache. R version 3.6.0, Shiny version 1.4.0 Browser Version:
Output of
sessionInfo()
:Example application or steps to reproduce the problem
See the two URLs above. These are publicly available.
The steps would be to create a subdirectory under the shiny-server directory on the host machine, and then copy a Rmd file (e.g., index.Rmd) into that subdirectory. The Rmd file renders correctly at the top level, but not in a lower level.
Describe the problem in detail
The problem is that when loading shared resource files, e.g.,
shiny.min.js
, the sever returns a 404 error instead of the file. In particular, if the Rmd file is in the XXX subdirectory, then the browser expands "shared/shiny.min.js" as ".../XXX/shared/shiny.min.js". This then returns a not-found.I'm calling this an error under shiny not shiny-server as I've tracked the issue down into the shiny package and not the server code.
I think the issue is in resourcePathHandler(), as I think that "XXX/shared/shiny.min.js" needs to be remapped to "shared/shiny.min.js", but this is not happening for some reason.
I'm kind of stuck as I'm not sure how to debug further than I've gotten.