ShinyProxy not honoring HTTP_X_FORWARDED_PREFIX for proxied calls

Hi Team,

We are using ShinyProxy (3.2.2) behind IIS with URL Rewrite enabled.

The initial application requests correctly honor the HTTP_X_FORWARDED_PREFIX header and the forwarded path is applied as expected.

However, when requests are redirected to the following ShinyProxy internal endpoints:

/app_proxy/…

/api/proxy/…

/heartbeat

/app_i/…

the HTTP_X_FORWARDED_PREFIX header is not being applied anymore.

Current Behavior (example)

Initial Request (correct):

/APPs/ActiveSession/Shinyapps/app/MyAnalyticsApp/

After redirection (incorrect):

/app_proxy/5d9a4c81-7b33-4a73-83d3-8f0dc4ff7b75/

Expected Behavior

We want all requests to maintain the prefix:

/APPs/ActiveSession/Shinyapps/app_proxy/5d9a4c81-7b33-4a73-83d3-8f0dc4ff7b75/

The goal is to ensure that every call routed through IIS preserves a consistent URL pattern.

Current ShinyProxy configuration (application.yaml)

server:

useForwardHeaders: true

forward-headers-strategy: framework

proxy:

title: Shiny Proxy

port: 8211

container-backend: docker

authentication: none

context-path: /shinyapps

hide-navbar: true

Question

Is there any ShinyProxy configuration option or recommended setup that ensures internal proxy routes (/app_proxy, /api/proxy, /heartbeat, /app_i) also honor the HTTP_X_FORWARDED_PREFIX header?

Any guidance or best practices for running ShinyProxy behind IIS with URL Rewrite would be greatly appreciated.

Thanks!

Chandra

Hi

Unfortunately we don’t have any experience with IIS.
However, you can run ShinyProxy on a sub-path by configuring a context-path: Configuration | ShinyProxy

I don’t think ShinyProxy supports the HTTP_X_FORWARDED_PREFIX header, but it should work with just the context-path setting.