<p>When I keep default of <code>proxy_body_size: 8m</code> of nginx. I can't upload the file size > 8M. Then I configure nginx annotation like this:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "ingress-name"
  annotations:

    nginx.ingress.kubernetes.io/proxy-body-size: 100m
</code></pre>

<p>So, I can upload the files > 8M now. But, I have tried to upload CSV file about 50m, I got an error </p>

<blockquote>
  <p>Failed to load <a href="https://api.domain.xxx/import" rel="nofollow noreferrer">https://api.domain.xxx/import</a>: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="https://web.domain.xxx/" rel="nofollow noreferrer">https://web.domain.xxx/</a>' is therefore not allowed access. The response had HTTP status code 400.</p>
</blockquote>

<p>Anyone can help me to upload the large maximum file is 100m?</p>

<p>Thanks</p>

Huy Chau
<p>The problem is that you are trying to upload the file from a different domain than the one specified in the ingress. It may be the same domain but a different port, protocol (http/https), prefixed with www., etc</p>

<p>By default, the browser doesn't allow those requests, because of security concerns. To allow them you should enable CORS: <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS</a></p>

<p>Fortunately, it's quite easy to enable CORS in an ingress, just add the following annotations to your api's ingress resource:</p>

<pre><code>nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, OPTIONS"
nginx.ingress.kubernetes.io/cors-allow-origin: "https://web.domain.xxx"
</code></pre>

<p>More info about those annotations <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/" rel="nofollow noreferrer">here</a></p>
