Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow whitelisted HTTP headers to pass through to shiny apps #257

Closed
wants to merge 1 commit into from

Conversation

sicarul
Copy link

@sicarul sicarul commented Oct 22, 2016

Added whitelist_headers configuration to shiny-server.conf.

This can be useful to adapt a report depending on the browser/referer of the visitor, or to relay additional information from a proxy sitting between the browser and shiny-server.

Added whitelist_headers configuration to shiny-server.conf. This can be useful to adapt a report depending on the browser/referer of the visitor, or to relay additional information from a proxy sitting between the browser and shiny-server.
@sicarul
Copy link
Author

sicarul commented Oct 22, 2016

image
This is an example of this pull request in action

@sicarul
Copy link
Author

sicarul commented Oct 23, 2016

Ok, i realized this way the headers are only sent the first time the app is accesed, i'll study how can i properly send the headers to the app and fix the PR...

@jcheng5
Copy link
Member

jcheng5 commented Oct 23, 2016

FYI this functionality is present in shiny server pro. http://docs.rstudio.com/shiny-server/#proxied-headers

If you do want to keep trying on this PR, please try to keep the diffs minimal. The header settings should be applied to the appSpec object. Take a look at other directives that are location-scoped, they should give you a sense of the pattern.

@sicarul
Copy link
Author

sicarul commented Oct 23, 2016

Thanks for the comments @jcheng5. I understood now where should i put the configuation code. Can you help me understand something? From what i see, this function: https://github.com/rstudio/shiny-server/blob/master/lib/router/config-router.js#L123

Is responsible for selecting which app will the user connect to, is that right? Does this mean that if there are no concurrent clients, the same shiny process is "recycled" without reconnecting? I don't understand, if it does that, how is it that when i enter an app the state i see is brand new, i think there's something more i'm not understanding :(

Thanks a lot

@jcheng5
Copy link
Member

jcheng5 commented Oct 23, 2016

Yes each shiny process can handle multiple connections and each connection can have its own state, because the shiny server function that you define is executed once per session. However the process will only calculate results for one session at a time.

http://shiny.rstudio.com/articles/scoping.html

@sicarul
Copy link
Author

sicarul commented Oct 24, 2016

Ok this has become much more complicated than i thought, mainly because SockJS seems to drop almost all headers, with no way to configure it except merging this PR. sockjs/sockjs-node#202

So i guess you are either using an altered version of SockJS or doing something else to pass those headers, either way, i'll not keep trying for now.

Thanks for the help

@sicarul sicarul closed this Oct 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants