<p>i'm trying to reverse proxy using nginx-ingress.</p>

<p>but i cannot find a way to apply reverse proxy in only certain paths</p>

<p>for example, i want apply reverse proxy <a href="http://myservice.com/about/" rel="nofollow noreferrer">http://myservice.com/about/</a>* from CDN static resources </p>

<p>and other paths serve my service (in example, it means 'my-service-web' service)</p>

<p>maybe in terms of k8s, CDN means "public external service" </p>

<p>in result, </p>

<ul>
<li><a href="http://myservice.com/about/" rel="nofollow noreferrer">http://myservice.com/about/</a>* -> reverse proxy from CDN (external service)</li>
<li><a href="http://myservice.com/" rel="nofollow noreferrer">http://myservice.com/</a>* -> my-service-web (internal service)</li>
</ul>

<p>here is my ingress.yaml file</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-service-web
  namespace: my-service
  annotations:
    kubernetes.io/ingress.class: nginx-ingress
    nginx.ingress.kubernetes.io/server-snippet: |
      location ~ /about/(.*) {

        proxy_pass  https://CDN_URL/$1${is_args}${args};

        ......and other proxy settings
      }

spec:  
  rules:
    - host: myservice.com
      http:
        paths:
          - path: /about
            ........how do i configuration this?
          - path: /*
            backend:
              serviceName: my-service-web
              servicePort: 80

</code></pre>

<p>how do i set rules and annotations?</p>

highalps
<p>You can create a service with <a href="https://kubernetes.io/docs/concepts/services-networking/service/#externalname" rel="nofollow noreferrer">externalName</a> type that will point to your external service (CDN) and it's well explained in this <a href="https://akomljen.com/kubernetes-tips-part-1/" rel="nofollow noreferrer">blog post</a>, for example:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
  namespace: my-service
spec:
 type: ExternalName
 externalName: FQDN
</code></pre>

<p>and then use it in your ingress rules by referring to the service name.</p>
