<p>I am deploying a shiny server in Kubernetes which has istio ingress.
we have a functioning ingressgateway installed too.</p>
<p>But when I try to access my shiny server through the gateway it fails with 400 Bad Request.
The gateway is enabled with https.
I tried multiple modifications to the shiny-server.conf file and virtualservice.yml for shiny server but no luck. I don't even know how to proceed with further troubleshooting.</p>
<p>Please help.</p>
<p>Dockerfile for shinyserver app</p>
<pre><code>FROM rocker/shiny:3.6.3

# Install Ubuntu packages
RUN apt-get update &amp;&amp; apt-get install sudo gdebi-core pandoc pandoc-citeproc libcurl4-gnutls-dev libxt-dev libssl-dev libxml2-dev libjpeg-dev -y


# Install R packages that are required

RUN R -e &quot;install.packages(c('shiny', 'shinydashboardPlus', 'shinydashboard', 'jsonlite', 'dplyr', 'DT', 'config', 'shinyalert', 'curl', 'scales', 'plotly', 'shinyjs', 'data.table', 'shinythemes', 'gridExtra', 'ggplot2', 'httr', 'bsplus', 'shinyWidgets', 'ggiraph', 'ggiraphExtra', 'xml2', 'ggmap', 'leaflet', 'maps', 'viridis', 'htmlwidgets', 'zoo', 'reshape2', 'httpuv'), repos='http://cran.rstudio.com/')&quot;

COPY /app /srv/shiny-server/executive/

EXPOSE 80

COPY shiny-server.conf  /etc/shiny-server/shiny-server.conf

CMD [&quot;/usr/bin/shiny-server.sh&quot;]
</code></pre>
<p>Shiny-server.conf file:</p>
<pre class="lang-sh prettyprint-override"><code># Define the user we should use when spawning R Shiny processes
run_as shiny;

# Define a top-level server which will listen on a port
server {
  # Instruct this server to listen on port 80. The app at dokku-alt need expose PORT 80, or 500 e etc. See the docs
  listen 80;

  # Define the location available at the base URL
  location / {

    # Run this location in 'site_dir' mode, which hosts the entire directory
    # tree at '/srv/shiny-server'
    app_dir /srv/shiny-server/executive;

    # Define where we should put the log files for this location
    log_dir /var/log/shiny-server;

    # Should we list the contents of a (non-Shiny-App) directory when the user
    # visits the corresponding URL?
    directory_index off;
  }
}
</code></pre>
<p>K8s deployment:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: &quot;executive&quot;
  namespace: default
  labels:
    app: &quot;executive&quot;
spec:
  replicas: 1
  selector:
    matchLabels:
      app: &quot;executive&quot;
  template:
    metadata:
      labels:
        app: &quot;executive&quot;
    spec:
      containers:
        - name: &quot;executive&quot;
          image: appexecutive1
          imagePullPolicy: Always
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: &quot;executive&quot;
  namespace: default
spec:
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP
  type: ClusterIP
  selector:
    app: &quot;executive&quot;
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: executive-ingress
  namespace: ingress-system
spec:
  hosts:
  - &quot;*&quot;
  gateways:
  - apollox-istio-gateway
  http:
  - match:
    - uri:
        prefix: /executive/
    rewrite:
        uri: /
    route:
    - destination:
        host: executive.default.svc.cluster.local
        port:
          number: 80
</code></pre>
<p>Now when I try to access it from gateway at below URL in our system it fails with 400 Bad Request.
<a href="https://10.20.33.134:32000/executive/" rel="nofollow noreferrer">https://10.20.33.134:32000/executive/</a></p>
<p>Need some assistance with identifying the cause or what direction I should take.</p>
<p>Thanks and Regards.</p>

justin xa
<p>It seems to be working now. i had forgot to add the httpuv package in my latest Dockerfile.
After adding this package it started working.</p>
<p>Thanks.</p>
