How to setup proxy from nginx-ingress to S3 bucket

Long story short. I got a task to proxy few pages from our main website to files hosted in S3 bucket. I tried different ways to do so which I found in internet, but I had not luck with them. Everytime something was broken.

But source of my problem was in attempts to configure this with nginx.ingress.kubernetes.io/server-snippet annotation.

In real life configuration for this task in my case look much easier.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /de/test-spezial-angebot/$2
    nginx.ingress.kubernetes.io/upstream-vhost: <MY_S3_BUCKET_NAME>.s3-website-eu-west-1.amazonaws.com
    nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
    nginx.ingress.kubernetes.io/use-regex: "true"
  name: microsite-test-special-offer-ingress
  namespace: dev-frontend-01
spec:
  rules:
  - host: <MY_DOMAIN_NAME>
    http:
      paths:
      - backend:
          serviceName: static-assets
          servicePort: 80
        path: /de-([a-z][a-z])/test-spezial-angebot/(.*)
---
kind: Service
apiVersion: v1
metadata:
  name: static-assets
  namespace: dev-frontend-01
spec:
  type: ExternalName
  externalName: "<MY_S3_BUCKET_NAME>.s3-website-eu-west-1.amazonaws.com"
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 80

Important note

I was very lazy to check if nginx-ingress would properly proxy requests and handle default index file name. So I just enabled Static website hosting in properties for my S3 bucket.

Route tables