apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    # OAI-PMH uses HTTP transport, ie. we can't redirect *all* traffic to https.
    # However, we need to make sure that 'our internal' nginx redirects http:// -> https://
    # (except for /repository/oai).
    ingress.kubernetes.io/ssl-redirect: "false"
    # But just to be sure, we are /also/ redirecting here.
    ingress.kubernetes.configuration-snippet: |
      if ($scheme = "http") {
        set $rewrite_https 1;
      }
      if ($request_uri ~ "^/repository/oai") {
        set $rewrite_https 0;
      }
      if ($rewrite_https = 1) {
        return 301 https://$server_name$request_uri;
      }
    ingress.kubernetes.io/secure-backends: "true"
  name: dspace-ingress
  namespace: dspace-dev
spec:
  rules:
  - host: clarin-dev.eurac.edu
    http:
      paths:
      - backend:
          serviceName: nginx
          servicePort: 443
        path: /
  tls:
  - hosts:
    - clarin-dev.eurac.edu
    secretName: host-tls-cert
