# Adding trailing slash to shiny app

**URL:** <https://community.traefik.io/t/adding-trailing-slash-to-shiny-app/18530>\
**Category:** Traefik v2\
**Tags:** docker-swarm\
**Created:** [May 5, 2023, 6:54am UTC](https://community.traefik.io/t/adding-trailing-slash-to-shiny-app/18530 "2023-05-05T06:54:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardtc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/richardtc/32/4458_2.png) [@richardtc](https://community.traefik.io/u/richardtc)\
**Post date:** [May 5, 2023, 6:54am UTC](https://community.traefik.io/t/adding-trailing-slash-to-shiny-app/18530/1 "2023-05-05T06:54:23Z")

</div>

Hi,  
I'm trying to render a shiny app (in docker swarm mode) using traefik, but the app does not render fully without the trailing slash.  
I've tried modifying the docker compose yml file to add a trailing slash but still the app does not render - it only renders fully when a slash (/) is manually added to the URL in the browser.

I've been trying to resolve this for ages without any success.

Any feedback would be appreciated.

Here are the labels in my current yml file:

```
     - "traefik.enable=true"
     - "traefik.docker.network=test_net2"
     - "traefik.http.routers.app.entrypoints=web"   
     - "traefik.http.routers.app.rule=Host(`domain.com`, `www.domain.com`) && PathPrefix(`/app`)" 
     - "traefik.http.middlewares.app.stripprefix.prefixes=/app"
     - "traefik.http.routers.app.middlewares=app@docker"
     - "traefik.http.services.app.loadbalancer.server.port=3838"
     - "traefik.http.services.app.loadbalancer.sticky=true"
     - "traefik.http.services.app.loadbalancer.sticky.cookie.name=stickycookie"       
     - "traefik.http.services.app.loadbalancer.sticky.cookie.secure=true" 
     - "traefik.http.routers.app.entrypoints=websecure"
     - "traefik.http.routers.app.tls=true"
     - "traefik.http.routers.app.tls.certresolver=le"

```

I'm using traefik:2.5.3

The above code enables the app to be fully rendered at [domain.com/app/](http://domain.com/app/), but not [domain.com/app](http://domain.com/app)

I've tried the following and it makes not difference to the above:

```
     - "traefik.frontend.redirect.regex=^(.*)/app$$"
     - "traefik.frontend.redirect.replacement=$$1/app"
     - "traefik.frontend.rule=PathPrefix:/app;ReplacePathRegex: ^/app(.*) /$$1"

```

I've visited many web pages and tried various middlewares

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [May 5, 2023, 7:22am UTC](https://community.traefik.io/t/adding-trailing-slash-to-shiny-app/18530/2 "2023-05-05T07:22:06Z")

</div>

I recommend to update to a recent Traefik version (v2.10) and use something like [traefik/whoami](https://github.com/traefik/whoami) to check the path received by the target service.

Note hat it is not best practice to have an app with a `PathPrefix` and `StripPrefix`, as the app might return paths in html like `/js/script.js` which will not work with your setup. Best practice for apps is to use a sub-domain.

---

<div class="post-metadata">

**Author:** ![richardtc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/richardtc/32/4458_2.png) [@richardtc](https://community.traefik.io/u/richardtc)\
**Post date:** [May 5, 2023, 8:07am UTC](https://community.traefik.io/t/adding-trailing-slash-to-shiny-app/18530/3 "2023-05-05T08:07:03Z")

</div>

I can get the apps to render by specifying the subdomains (copied below for reference).

It would be nice to be able to get Docker swarm Shiny apps to work with an appended path to the domain, but will use subdomain for the timebeing. Thanks.

```
     - "traefik.enable=true"
     - "traefik.docker.network=test_net2"
     - "traefik.http.routers.app.entrypoints=web"   
     - "traefik.http.routers.app.rule=Host(`app.domain.com`)"
     - "traefik.http.middlewares.app.stripprefix.forceSlash=false"
     - "traefik.http.routers.app.middlewares=app@docker"
     - "traefik.http.services.app.loadbalancer.server.port=3838"
     - "traefik.http.services.app.loadbalancer.sticky=true"
     - "traefik.http.services.app.loadbalancer.sticky.cookie.name=stickycookie"       
     - "traefik.http.services.app.loadbalancer.sticky.cookie.secure=true" 
     - "traefik.http.routers.app.entrypoints=websecure"
     - "traefik.http.routers.app.tls=true"
     - "traefik.http.routers.app.tls.certresolver=le"

```
