Nginx 10 minute timeout occurring - amazon-web-services

I have an AWS-hosted web application that initiates a long-running server process (more than 10 mintues). An Nginx reverse proxy server sits between the application load balancer (ALB) and the service. Both the Nginx server and the service reside within separate Kubernetes pods running on an EC2 instance.
I'm experiencing an issue with a connection being closed. The Nginx logs show a HTTP 499 error:
(][05/Dec/2022:12:02:27 +0000] "POST -------------- HTTP/1.1" 499 0
"https://------------.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X
10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0
Safari/537.36")
The issue is repeatable and occurs exactly 10 minutes after the request was initiated. Despite my having set the ALB, Nginx, and SQL Alchemy timeouts to be much longer than 10 minutes, I suspect a timeout is occurring with a default value of 10 minutes, but I can't figure out where.
Nginx is the product I'm least familiar with and so I suspect that I have failed to make the necessary timeout configs in its conf file. I have set this:
proxy_read_timeout 20m;
Can anyone suggest where in the system the default timeout is occurring?

Related

Swagger UI path not using path in flask restplus

In our code:
app = Flask(name)
blueprint = Blueprint('api',name,url_prefix='/api')
api = Api(blueprint, doc='/doc/')
app.register_blueprint(blueprint)
From the log..it's not using the prefix...swaggerui is off root.
"GET /swaggerui/bower/swagger-ui/dist/fonts/DroidSans-Bold.ttf HTTP/1.1" 200 0
"http://10.99.72.221:5002/api/doc/" "Mozilla/5.0 (Macintosh; Intel Mac OS X
10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2
Safari/603.3.8"
It's causing issues for AWS Application Load Balancer, as the only route I can define is /api, since it's running inside a Docker container.
Is there a way to insert a path in front of /swaggerui?

My ngrok Tunne Status shows reconnecting running on a custom port (4901)

I am running a ngrok on 4901 port.
I am also running a flask webserver on the same port. The idea is that I want to access my local webserver from outside world to do some app testing.
What am I missing ?
NGROK running on 4901
./ngrok 4901
ngrok
Tunnel Status reconnecting Version
1.7/ Web Interface 127.0.0.1:4040
# Conn 0 Avg Conn Time 0.00ms
FLASK:
python webserver.py
* Running on http://0.0.0.0:4901/
127.0.0.1 - - [01/Jul/2016 15:16:02] "GET / HTTP/1.1" 200 -
You are using ngrok version 1.7, which has now been shut down completely. Quoting from their announcement:
As of April 4, 2016, all 1.X sessions were no longer be and service ended completely.
You should be able to upgrade to version 2.0+ and keep using it, although I haven't tried it yet myself.

Internal Server Error on access via HTTPS to a Django application

I'm trying to make an access to my Django application by HTTPS.
In the config.py of the project I has set the key
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https')
On my configuration to serve all I've an Apache 2.4 so I've create the right entry into "sites-availables" directory, obviously followed by a2ensite, I've generate my own SSL Key (.crt and .key files), changed ownership and permission, restared apache2.
When I try to access to the site I got the follow error message
"""
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator at webmaster#localhost to
inform them of the time this error occurred, and the actions you
performed just before this error.
More information about this error may be available in the server error log.
Apache/2.4.7 (Ubuntu) Server at inno Port 9443
"""
I've take a look into /var/log/apache2/error.log but there's nothing, on /var/log/apache2/access.log I've found
xxx.xxx.xxx.xxx - - [25/May/2016:12:29:36 +0200] "GET /favicon.ico
HTTP/1.1" 500 996 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64;
rv:46.0) Gecko/20100101 Firefox/46.0"
There are someone that can give me some hint?
Thanks a lot
Carlos
It looks like your virtual host within apache isnt properly configured so it's not handling php files the way it should. I guess you should use a handler directive in order to tell apache to handle all .php files and most probably your issue will be fixed. This is the maximum that can be done since you didn't provide much info about the error.

Show the Real IP in the Logs of a Keter Managed App

I would like to display the actual IP of the request as opposed to the localhost in my log files. Since Keter manages the Nginx config I am not sure what I need to change to get the real ip.
This is what I see now:
127.0.0.1 - - [11/Jan/2014:09:25:08 +0000] "GET /favicon.ico HTTP/1.1" 200 - ""
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:27.0) Gecko/20100101 Firefox/27.0"
Keter hasn't been based on nginx for quite a while now. Recent versions of Keter set the X-Real-IP request header to containing the client's IP address (see issue #8), which you can use in wai-extra via IPAddrSource.

Nginx Bad Gateway with Django Social Auth and uwsgi

My site is running correctly locally (using the built in runserver), but when running with nginx and uwsgi, I'm getting a Bad Gateway (502) during the django-social-auth redirect.
The relevant nginx error_log:
IPREMOVED - - [11/Oct/2012:12:10:18 +1100] "GET /complete/google/? ..snip .. HTTP/1.1" 502 574 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.26 Safari/537.11"
The uwsgi log:
invalid request block size: 4204 (max 4096)...skip
Thu Oct 11 12:16:46 2012 - error parsing request
Refreshing the Bad Gateway response redirects and logs in correctly. This happens every single time. The nginx and uwsgi logs here have different timing as they were separate requests. The logs are consistent.
This is the first time deploying django to nginx for me, so I'm at a loss as to where to start.
Have you tried increasing the size of the uwsgi buffer:
-b 32768
http://comments.gmane.org/gmane.comp.python.wsgi.uwsgi.general/1171