Apologies but this will be a bit of a wishy washy question, I am out of ideas at the moment; apart from testing all the connections (all look good individually) I am not sure what else I can even change. Please tell me if there is any other information I can give.
I built an AWS stack 2 days ago with requests to a Route 53 aliased to an Application Load Balancer (for SSL only), forwarding to a single EC2 instance over HTTP:80. The Instance is an Elastic Beanstalk Docker container, proxied with NGinx internally, running tomcat:9 hosting a java web app. I had a previous stack (the same components as far as I can see) which did not exhibit the problem below. Running the docker image in a local container also does not exhibit these symptoms.
All tests are done in a browser (Chrome and Firefox so far) with no other windows open, same with browser tools opened or closed.
When POSTING to the url for the first time 'in a while' the OPTIONS request has the timing profile below:
The "Initial Connection" is taking 21s! This is repeatable, every time it's the 'first time in a while'. Thereafter, we get the second profile. The POST part of the request then looks like this:
Any further requests get a good response (GET below).
Refreshing the page immediately and performing the same OPTIONS/POST gets the fast response.