<p>I'm trying to make a GET request to an application in Kubernetes (GKE) but is always returning 400 Bad Request.</p>
<p>The POST, PUT and DELETE methods are working perfectly.</p>
<p>And the strangest thing is that when I use the port-forward directly to the pod I haven't problem with the GET request.</p>
<p>I've tried to minimize the code of my application as much as possible and it looks like this:</p>
<pre class="lang-js prettyprint-override"><code>const express = require('express')
const app = express()
const port = 3000

app.use(express.json())
app.use(express.urlencoded({ extended: true }))

app.get('/', (req, res) =&gt; {
  res.send(req.body)
})

app.post('/', function(req, res){
  res.send(req.body);
});

app.put('/', function(req, res){
  res.send(req.body);
});

app.delete('/', function(req, res){
  res.send(req.body);
});

app.listen(port, () =&gt; {
  console.log(`Listening to port ${port}`)
})
</code></pre>
<p>I think that the problem is in my Ingress configuration because with port-forward it is working well. Here is my Ingress yaml:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
spec:
  tls:
    - hosts:
        - my-test-host
      secretName: tls-secret
  rules:
    - host: my-test-host
      http:
        paths:
        - path: /*
          backend:
            serviceName: my-test-service
            servicePort: 3000
</code></pre>
<p>Finally, this is the request that always return 400.</p>
<pre class="lang-sh prettyprint-override"><code>curl --location --request GET 'https://my-test-host/' \
--header 'Content-Type: application/json' \
--data-raw '{
    &quot;test&quot;: &quot;123&quot;
}'
</code></pre>
<p>The same request with other methods (POST, PUT or DELETE) is working well. Please, what I'm doing wrong?</p>

<p>I managed to find the solution to the problem.</p>
<p>The problem is that <strong>Ingress don't accept HTTP GET requests with body</strong> and responds with error 400.</p>
<p>The saddest thing is that I found nothing about this problem in the Kubernetes documentation anywhere.</p>
<p>I searched for good practice information on sending body in GET requests and then found these two links:</p>
<p><a href="https://www.rfc-editor.org/rfc/rfc7231#section-4.3.1" rel="nofollow noreferrer">https://www.rfc-editor.org/rfc/rfc7231#section-4.3.1</a></p>
<p><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET</a></p>
<p>As I understand it is not forbidden to send the GET with body, but it is not recommended.</p>
<p>So, to solve my problem I changed my code to get params from &quot;query&quot; instead &quot;body&quot; in the GET request:</p>
<pre class="lang-js prettyprint-override"><code>app.get('/', (req, res) =&gt; {
  res.send(req.query)
})
</code></pre>
<p>Consequently, I needed to change the sending parameters in my GET request:</p>
<pre class="lang-sh prettyprint-override"><code>curl --location --request GET 'https://my-test-host?test=123'
</code></pre>
<p>Lesson learned: To avoid problems, never accept GET requests with body.</p>
<p>Thanks.</p>
