We have a platform built using microservices architecture, which is deployed using Kubernetes and Ingress. One of the platform's components is a Django Rest API. The yaml for the Ingress is the below (I have changed only the service names & endpoints):
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: dare-ingress
annotations:
kubernetes.io/ingress.provider: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/rewrite-target: /$1
certmanager.k8s.io/issuers: "letsencrypt-prod"
certmanager.k8s.io/acme-challenge-type: http01
spec:
tls:
- hosts:
- demo-test.com
secretName: dare-ingress-tls
rules:
- host: demo-test.com
http:
paths:
- path: /prov/?(.*)
backend:
serviceName: prov
servicePort: 8082
- path: /(prov-ui/?(.*))
backend:
serviceName: prov-ui
servicePort: 8080
- path: /flask-api/?(.*)
backend:
serviceName: flask-api
servicePort: 80
- path: /django-rest/?(.*)
backend:
serviceName: django-rest
servicePort: 8000
The django component is the last one. I have a problem with the swagger documentation. While all the Rest calls work fine, when I want to view the documentation the page is not load. This is because it requires login and the redirection to the documentation does not work.
I mean that, without Ingress the documentation url is for example: https://demo-test.com/docs but using Ingress, the url should be https://demo-test.com/django-rest/login and then https://demo-test.com/django-rest/docs but the redirection does not work, I get a 404 error. Does anyone have any idea how to fix this in Ingress?
I managed to fix the redirection error (and stay logged in) using the FORCE_SCRIPT_NAME as suggested in a comment in this thread
However, now the swagger documentation is not properly loaded:
I followed the suggestions from here regarding the swagger documentation but still the page cannot be loaded properly. Any ideas?