apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: gallery-be
  namespace: sta-gallery-be
spec:
  hosts:
    - gallery-be.staging.adaoncloud.com
  gateways:
    - gallery-be-gateway
  http:
    - match:
        - scheme:
            exact: http
      redirect:
        scheme: https
        redirectCode: 302
    - match:
        - uri:
            prefix: /save-chunk
          method:
            exact: OPTIONS
        - uri:
            regex: .*/fetch-media/.*
          method:
            exact: OPTIONS
        - uri:
            regex: .*/user
          method:
            exact: OPTIONS
      route:
        - destination:
            host: sta-gallery-be
            port:
              number: 80
    - match:
        - uri:
            prefix: /save-chunk
          method:
            exact: POST
          headers:
            Authorization:
              prefix: Bearer
        - uri:
            regex: .*/fetch-media/.*
          method:
            exact: GET
          headers:
            Authorization:
              prefix: Bearer
        - uri:
            regex: .*/user
          method:
            exact: POST
          headers:
            Authorization:
              prefix: Bearer
      route:
        - destination:
            host: sta-gallery-be
            port:
              number: 80
    - match:
        - uri:
            prefix: /balance_me
          method:
            exact: GET
      route:
        - destination:
            host: sta-gallery-be
            port:
              number: 80
    - directResponse:
        status: 404
        body:
          string: 'Not Found'
      headers:
        response:
          set:
            content-type: 'text/html'
