Landing page for single app and navbar

Hi there,

I know that some of the former questions in this forum already deal with my question. Most of all, the question “Customize shinyproxy navbar and landing page” brought up the issue already. So please apologize some doubling. But as far as I can tell, non of the replies provide a definite answer to the questions. So I’ll try it again.

I have a single shiny app and I want to send users directly to this app. Apparently, I could change the index.html in the way jpg suggested. I am not an IT.Expert, but I always thought it is a dirty workaround to change source code.
Moreover, when I open shinyproxy_###.jar, change code and create a ###.jar fille again, I am not able to start this file anymore (it is now “corrupt”). So, is there another way to send users directly to the only app that I offer after sign in?

Plus, I want to customize the navbar. Namely, I want to change the black background into white, I want to change the color of the font and I want to change the blue color of buttons. Again, I could change the css, but I wonder if there is a direct way to change css or even to add my own css file (similar to shiny, where I can add my css-file to a www folder).

Thanks!

Hi @laurenzo,

You could provide a URL to your users that goes directly to that specific app, for example:

http://localhost:8080/app/01_hello

This URL will still be intercepted for login (if you have authentication configured), but it will skip the index page.

Regarding css customization, we are currently working towards a templating mechanism that would allow such customizations without having to recompile the jar. A contribution has already been submitted, this will be integrated in Shinyproxy soon: https://github.com/openanalytics/shinyproxy/pull/42

Regards,
Frederick

1 Like

Hi Frederick,

great, thanks for your reply. I’m sorry, I have to ask for some details. I guess, I have to put the url anywhere in application.yml, bur where exactly?

shiny:
proxy:
title: euler-test
landing-page: /
heartbeat-rate: 10000
heartbeat-timeout: 60000
port: 8080
authentication: simple
admin-groups: scientists
# Example: ‘simple’ authentication configuration
users:
- name: jack
password: password
groups: scientists
- name: jeff
password: password
groups: mathematicians
# Docker configuration
docker:
cert-path: /home/none
url: http://localhost:2375
port-range-start: 20000
apps:
– name: euler
display-name: Euler’s number
description: Adding another app to shinyproxy
docker-cmd: [“R”, “-e shiny::runApp(’/root/euler’)”]
docker-image: openanalytics/shinyproxy-template
groups: scientists, mathematicians

None of my attempts works… Thanks, Lorenz

Hi @laurenzo,

What I meant is, you could send a URL to your users that points directly to the app instead of a URL that points to the ShinyProxy main page.

Or, you could use a proxy like nginx and rewrite the URLs to go directly to the app.

I’m afraid ShinyProxy itself does not have any settings to configure such redirecting behaviour.

I’m new to shinyProxy and I was puzzled. Sorry, actually your first reply was quite clear already…
It is running now the way I want. Thanks a lot!

Hi!
How would you rewrite the URL to go directly to the app? I tried various ways of doing that, but without success. Do you need to modify the application.yml file as well?

Hi @KZARCA,

E.g. suppose that you host a shinyproxy instance at https://exampledomain.com/
A URL to go directly to a specific app, would be: https://exampledomain.com/app/01_hello

If a user visits the first link, they will get a login screen and then the app listing page.
If a user visits the second link, they will get a login screen and then the app 01_hello.

Hi!
I am trying to change the url to get into my app, in that way :
replace http://localhost:8080/app/myapp to http://localhost

I configured nginx this way :

 server {
    server_name localhost
    listen 80;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 600s;
        proxy_set_header  Host             $host;
        proxy_set_header  X-Real-IP        $remote_addr;
        proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header  X-Forwarded-Proto $scheme;
    
    location / {
        rewrite (.*)/$ /app/myapp$1 break;
        proxy_pass         http://127.0.0.1:8080;
    }
}

Shinyproxy starts, but I get a 404 error with the GET request of the container of myapp. Here is the log:

2018-06-12 12:32:55.880  INFO 8247 --- [  XNIO-2 task-6] c.s.docker.client.DefaultDockerClient    : Starting container with Id: 842a34357e8ccf2afd06d366a294f9c0af57b672ab9cac0a1e74c3af20bdab3c
2018-06-12 12:32:59.365  INFO 8247 --- [  XNIO-2 task-6] e.o.shinyproxy.services.ProxyService     : Proxy activated [user: 712TnenBEm3-AKjFqTd_aUdKMl7G_7QhdtSjJgcZ] [app: myapp]

The application.yml file is the default one, with authentication: none
What did I miss?

Hi @KZARCA,

I believe that rewrite is too general. It will rewrite every request, including the request of the iframe that should not be modified.

I don’t have a test environment near at hand, but I think you’ll want to have a rule like this, that only rewrites requests for the / index page:

location = / {
    rewrite ^ /app/myapp break;
    proxy_pass         http://127.0.0.1:8080;
}
location / {
    proxy_pass         http://127.0.0.1:8080;
}
3 Likes

That’s working now! Thanks a lot for your help!

@KZARCA, @laurenzo

ShinyProxy 2.2.1 allows to use the landing-page setting to redirect the user to a single Shiny app (/app/<app-name> or /app_direct/<app-name>) instead of the list of Shiny apps (default; /). See https://www.shinyproxy.io/downloads/

Best,
Tobias

1 Like