Swagger UI path not using path in flask restplus - flask

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?

Related

Nginx 10 minute timeout occurring

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?

azure app service treating websocket request as http and hence not found

So when a 'ws' request hits my django server on azure app service in logs it shows
2022-05-27T03:40:41.606708018Z Not Found: /tm/123
2022-05-27T03:40:41.608467127Z 169.254.130.1 - - [27/May/2022:03:40:41 +0000] "GET /tm/123 HTTP/1.1" 404 4190 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36"
So this may be due to daphne service is not on in my server environment
when I put a startup command for daphne it gives error

Flask SocketIO bad Request 400

My flask chat application was working fine on localhost development server. But when i hosted my app on heroku nothing is working properly and i checked console to find lots of Bad Requests.
Both GET and POST requests are getting 400 errors.
"GET /socket.io/?EIO=3&transport=polling&t=1592543494128-64&sid=6740d63740c24f6ca6bd7234325a7c21 HTTP/1.1" 400 11 "https://flack-ma.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36"
"POST /socket.io/?EIO=3&transport=polling&t=1592543547379-72&sid=8eadd5ac2bcf4ff1a414d878aa506839 HTTP/1.1" 400 11 "https://flack-ma.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36"
App worked fine on localhost.
Deployment Link
Project Repo
I dont know whats wrong.

How do I view the requests submitted to my AWS web service?

I am trying to set up a web service on AWS Elastic Beanstalk, however whenever I submit a request to the server, it responds with a 404 error.
Is there a way to view a log of the traffic to my AWS server, so I can view whether or not requests are actually being submitted, and whether or not they are properly formed so I may potentially narrow down the origin of the problem?
Log for requests sent to the server can be found under:
/var/log/nginx/access.log
You can see a snippet of my log below:
-------------------------------------
/var/log/nginx/access.log
-------------------------------------
141.163.107.3 - - [25/Nov/2016:15:50:33 +0000] "GET / HTTP/1.1" 200 2111 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"
141.163.107.3 - - [25/Nov/2016:15:51:01 +0000] "GET /HelloWorld HTTP/1.1" 404 490 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"

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.