Open anv42 opened 5 years ago
@blairj09 do you think this is related to the other RSC bug?
Unfortunately, this is a known issue in RStudio Connect that is currently being worked on. The problem is that the pre-flight request sent by the web browser doesn't contain the Authorization
header that RStudio Connect expects, so an error is returned. If you can open the API up without requiring RStudio Connect authentication, then the second CORS filter you've described will work.
If you can open the API up without requiring RStudio Connect authentication, then the second CORS filter you've described will work.
How would one use an API hosted on RStudio Connect that requires the authentication? Does something need to be changed in the API (like the CORS), or does this involve sending credentials in the header of a request being made?
@averyrobbins1 to access an authenticated API hosted on RStudio Connect, you supply a valid RStudio Connect API key in an Authorization
header with the request. More details can be found here.
Unfortunately, this is a known issue in RStudio Connect that is currently being worked on. The problem is that the pre-flight request sent by the web browser doesn't contain the
Authorization
header that RStudio Connect expects, so an error is returned. If you can open the API up without requiring RStudio Connect authentication, then the second CORS filter you've described will work.
Any solutions to this issue yet? I'm having the exact issue described above - the plumber API hosted on RSC works fine when no authentication required, but as soon as authentication is required I get the preflight warning above - using RSC 1.8.8
CORS may need to be enabled in RStudio Connect: https://docs.rstudio.com/connect/admin/appendix/configuration/#CORS
Hello,
I'm trying to access a Plumber API hosted on an RStudio Connect Server from Chrome. Here's a simplified structure of the plumber.R file :
This API is working with a simple CURL statement issued from the command line, like so:
However, when I try to access the same API by submitting a fetch request from the chrome console, I get a 404 response.
Here's the call to the API from the Chrome Console :
And here's the error:
In order to fix the issue, I tried adding two kinds of approaches to a filter on top of my plumber.R script as suggested before in the forum but they don't work and I'm getting the exact same response. Here are the filters:
Has anyone faced this before and been able to resolve it? I'd be grateful for any kind of help on this.