<p>I have a website:</p>

<p>xyz.com -> Standalone Angular4 APP (Container)</p>

<p>xyz.com/api/ -> Standalone Rails API APP (Container - ruby-2.4.0)</p>

<p>xyz.com/api/sidekiq -> Mounted to Rails api routes.</p>

<p>When I try to access the /api/sidekiq it loads the data but assets are still pointing to xyz.com/sidekiq instead of xyz.com/api/sidekiq. And all when I click retry it tries to submit to xyz.com/sidekiq instead of xyz.com/api/sidekiq. Is there a way to force sidekiq to use a different assets path and base url path?</p>

<p>Is there a way to get the sidekiq web view as a seperate standalone application container?</p>

<p>I am using Kubernetes as my orchestration tool. I am using Nginx Ingress to do path based routing. When I go to xyz.com/api/sidekiq it loads the data but the urls and assets point xyz.com/sidekiq which is why I cant retry a sidekiq job as the sidekiq web doesn't work.</p>

<p>You can have a look at the thread I raised with sidekiq team "<a href="https://github.com/mperham/sidekiq/issues/3815" rel="nofollow noreferrer">Sidekiq Route Mount doesn't rewrite URL in Rails API</a>" that helped me understand how sidekiq <code>mount "/sidekiq"</code> works.</p>

<p>I have a simple work around for this problem and found it to be the best way to resolve my path based routing issue. You can do this using <code>nginx.ingress.kubernetes.io/rewrite-target</code> annotations in your Ingress configurations by writing 2 Ingress rules as shown below: </p>

<ol>
<li><p>Routing the "<strong>/</strong>" path to the root path of the rails-app-service ( 
<code>xyz.com/* -&gt; rails-app-service/*</code> )</p></li>
<li><p>Routing the "<strong>/sidekiq</strong>" path to the sidekiq web mount path of the rails-app-service ( 
<code>xyz.com/sidekiq/* -&gt; rails-app-service/sidekiq/*</code> )</p></li>
</ol>

<p>To know more about Nginx Ingress Controller rewrite target annotation check the official repository for details: <a href="https://github.com/kubernetes/ingress-nginx/tree/master/docs/examples/rewrite#rewrite-target" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx/tree/master/docs/examples/rewrite#rewrite-target</a></p>

<p>This is my final code snippet with the solution: </p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "rails-app-ingress"
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: xyz.com
    http:
      paths:
      - path: /
        backend:
          serviceName: "rails-app-service"
          servicePort: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "rails-sidekiq-ingress"
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /sidekiq
spec:
  rules:
  - host: xyz.com
    http:
      paths: 
      - path: /sidekiq
        backend:
          serviceName: "rails-app-service"
          servicePort: 80
</code></pre>
