Getting 404 on a defined ressource with in path parameter - flask-restful

I started to learn Python with connexion and flask and got stuck resolving an issue. Even after taking a long break I cannot see where I am wrong and need some advise.
I created a swagger API definition which maps /api/blacklist/{zipcode} to a function. However when I try to access /api/blacklist/12345 I receive a 404. The YAML is located here:
https://github.com/TheHasgarion/pythonflaskrest/blob/master/api.yml
The mapping for /api/blacklist/ works just fine. BTW, even accessing /api/blacklist/ gives me a 404.
The server log says:
127.0.0.1 - - [23/Jun/2019 19:52:09] "GET /api/blacklist/12345 HTTP/1.1" 404 -
127.0.0.1 - - [23/Jun/2019 19:57:16] "GET /api/blacklist HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2019 19:57:18] "GET /api/blacklist/ HTTP/1.1" 404 -
Thank you very much in advance for guidance.

Apparently you need to use integer as type, not number. Whyever 'number' means 'float' :-)

Related

Symfony Weblate: Error when pushing component translations

I am using the package m2mtech/weblate-translation-provider to push Symfony translations to a self-hosted Weblate instance.
When calling this command:
bin/console translation:push --domains=messages weblate -vv
I get the following error in the logs:
INFO [http_client] Request: "GET https://WEBLATE_DOMAIN/api/projects/MY_PROJECT/components/"
INFO [http_client] Response: "200 https://WEBLATE_DOMAIN/api/projects/MY_PROJECT/components/"
INFO [http_client] Request: "GET http://WEBLATE_DOMAIN/api/components/MY_PROJECT/messages/translations/"
INFO [http_client] Redirecting: "308 https://WEBLATE_DOMAIN/api/components/MY_PROJECT/messages/translations"
INFO [http_client] Response: "404 https://WEBLATE_DOMAIN/api/components/MY_PROJECT/messages/translations"
In TranslationApi.php line 66:
[Symfony\Component\Translation\Exception\ProviderException]
Unable to get weblate components translations for messages.
Why does the last URL get a 404 response? Did I set up Weblate incorrectly or am using the command line tool wrong?
The second request is using HTTP.
You should replace it by HTTPS to prevent the broken redirect.
The URL is missing the trailing slash - it should be https://WEBLATE_DOMAIN/api/components/MY_PROJECT/messages/translations/

Seeing GET /server-status every 10 seconds from localhost in access log

I'm using nginx for a reverse proxy in a lab environment for a POC. While looking through the nginx access.log file I see this entry every 10 seconds
127.0.0.1 - - [06/Aug/2019:02:16:50 +0000] "GET /server-status HTTP/1.1" 404 152 "-" "Go-http-client/1.1"
I'm trying to figure out what is the source of this and reason behind it. It's really just curiosity and me trying to understand more about nginx as a reverse proxy. Where else should I be looking to further understand what's going on?
Thanks!
I'm about a year late to answering, but for me this was a request made by Netdata and disabling its NGINX statistics collector removed these requests.

how to by pass proxy to for the rest api call

I am using robotframework and I would like know what can I do so that I can avoid going through the proxy? I am using Windows and I have made sure there are no proxy variables in environment variables. I am also connected via WI-FI unlike others who are on LAN for who do not see issue with the GET request.
KEYWORD ${resp} = RequestsLibrary . Get Request session, /token, params=${user info}, headers=${HEADER}
Documentation:
Send a GET request on the session object found using the
Start / End / Elapsed: 20180102 13:17:11.558 / 20180102 13:18:26.569 / 00:01:15.011
13:17:11.566 DEBUG Starting new HTTP connection (1): proxy-sanfran
13:17:11.577 DEBUG http://proxy-sanfran:80 "GET http://localhost:9000/token?userName=test_user&password=test123 HTTP/1.1" 301 None
13:17:11.586 DEBUG Resetting dropped connection: proxy-sanfran
13:18:26.566 DEBUG http://proxy-sanfran:80 "GET http://10.138.37.40 HTTP/1.1" 503 787
13:18:26.568 INFO Get Request using : alias=session, uri=/token, headers={'Content-Type': 'application/json'} json=None
13:18:26.568 INFO ${resp} = <Response [503]>
try with setting environment variable
NO_PROXY = "localhost"

is this a bug of nginx: open() "/usr/share/nginx/html/testproxy.php" failed

i am new to nginx, yesterday i installed lemp on centos and hosted a website on. today i get this in error message. please tell me if this is a security bug of nginx? Thank you!
cat /var/log/nginx/error.log
2017/07/01 03:52:18 [error] 6073#0: *23151 open() "/usr/share/nginx/html/testproxy.php" failed (2: No such file or directory), client: 91.196.50.33, server: _, request: "GET http://testp3.pospr.waw.pl/testproxy.php HTTP/1.1", host: "testp3.pospr.waw.pl"
It's not an nginx bug: If you're currently running a site that's live and accessible on the internet, bot scripts will try to find common vulnerabilities by hitting your server with various automated requests of common URLs, paths and patterns (e.g. admin.php, /wp-login.php for WordPress blogs...). Just make sure you set up proper security for your server and you'll be fine.

How to install Nginx on OpenShift

Though I followed https://blog.openshift.com/lightweight-http-serving-using-nginx-on-openshift/ step by step, I ended up getting the error 503, telling me service is unavailable. There are questions on various websites, including stackoverflow, but all of them are about issues after a successful installation of nginx, a point I haven't arrived at yet.
I don't want to use already available cartridges - in part because most of them are out-of-date. Also, an answer to my question might be of interest to some people, inasmuch as it will teach how to run always the latest nginx server on OpenShift.
This is rhc tail result
DL is deprecated, please use Fiddle
==> app-root/logs/diy.log <==
[2014-12-06 16:55:47] INFO WEBrick::HTTPServer#start done.
[2014-12-06 16:55:50] INFO WEBrick 1.3.1
[2014-12-06 16:55:50] INFO ruby 1.8.7 (2013-06-27) [x86_64-linux]
[2014-12-06 16:55:50] INFO WEBrick::HTTPServer#start: pid=255959 port=8080
127.xx.x.xxx - - [06/Dec/2014:17:11:57 EST] "HEAD / HTTP/1.1" 200 0
- -> /
127.xx.x.xxx - - [06/Dec/2014:17:11:57 EST] "HEAD / HTTP/1.1" 200 0
- -> /
[2014-12-06 17:32:02] INFO going to shutdown ...
[2014-12-06 17:32:02] INFO WEBrick::HTTPServer#start done.
==> app-root/logs/server.log <==
nginx: [emerg] invalid port in ":" of the "listen" directive in /var/lib/openshi
ft/xxx/app-root/data//conf/nginx.conf:36
This guide (2012 year) uses environment variables: $OPENSHIFT_INTERNAL_IP:$OPENSHIFT_INTERNAL_PORT
Now it was renamed to:
$OPENSHIFT_DIY_IP:$OPENSHIFT_DIY_PORT
If all you want is nginx on OpenShift I would use this cartridge instead
https://github.com/gsterjov/openshift-nginx-cartridge
Here's a cartridge that's updated to the most recent nginx 1.9.12

Resources