how to by pass proxy to for the rest api call - robotframework

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"

Related

GCP deployment with nginx - uwsgi - flask fails

I have a very simple flask app that is deployed on GKE and exposed via google external load balancer. And getting random 502 responses from the backend-service (added a custom headers on backend-service and nginx to make sure the source and I can see the backend-service's header but not nginx's)
The setup is;
LB -> backend-service -> neg -> pod (nginx -> uwsgi) where pod is the application built using flask and deployed via uwsgi and nginx.
The scenario is to handle image uploads in simple-secured way. Sender sends me a token with upload request.
My flask app
receive request and check the sent token via another service using "requests".
If token valid, proceed to handle the image and return 200
If token is not valid, stop and send back a 401 response.
First, I got suspicious about the 200 and 401's. And reverted all responses to 200. Following some of the expected responses, server starts to respond 502 and keep sending it. "Some of the messages at the very beginning succeeded".
nginx error logs contains below lines
2023/02/08 18:22:29 [error] 10#10: *145 readv() failed (104: Connection reset by peer) while reading upstream, client: 35.191.17.139, server: _, request: "POST /api/v1/imageUpload/image HTTP/1.1", upstream: "uwsgi://127.0.0.1:21270", host: "example-host.com"
my uwsgi.ini file is as below;
[uwsgi]
socket = 127.0.0.1:21270
master
processes = 8
threads = 1
buffer-size = 32768
stats = 127.0.0.1:21290
log-maxsize = 104857600
logdate
log-reopen
log-x-forwarded-for
uid = image_processor
gid = image_processor
need-app
chdir = /server/
wsgi-file = image_processor_application.py
callable = app
py-auto-reload = 1
pidfile = /tmp/uwsgi-imgproc-py.pid
my nginx.conf is as below
location ~ ^/api/ {
client_max_body_size 15M;
include uwsgi_params;
uwsgi_pass 127.0.0.1:21270;
}
Lastly, my app has a healthcheck method with simple JSON response. It does no extra stuff and simply returns. This never fails as explained above.
Edit : my nginx access logs in the pod shows the response as 401 while the client receives 502.
for those who gonna face with the same issue, the problem was post data reading (or not reading).
nginx was expecting to get post data read by the proxied, in our case uwsgi, app. But according to my logic I was not reading it in some cases and returning back the response.
Setting uwsgi post-buffering solved the issue.
post-buffering = %(16 * 1024 * 1024)
Which led me to this solution;
https://stackoverflow.com/a/26765936/631965
Nginx uwsgi (104: Connection reset by peer) while reading response header from upstream

how to request a subdirectory http GET request networking

I'm trying to fetch a subdirectory using a get request.
What I've tried (for mysite.com/search):
char message[] = "GET / \r\nHost:mysite.com/search\r\n\n\n";
This however is giving me a 400 error (bad request)
How do I correctly request a subdirectory?
Host only accepts the base url/ip. See that / right after the GET? That's where you request any subdirectories/files you want. The / you have there now indicates that you want the top level dictionary.
What you are looking for is:
char message[] = "GET /search \r\nHost:mysite.com\r\n\n\n";

Netscaler monitoring custom headers

I'm trying to setup monitoring (http-ecv) with authorization header, but I'm getting illegal character or header folding error (jetty 9.3)
1. example
GET /somepath/somepage.html HTTP/1.1
Server Running
\r\nAuthorization: Basic somestring=\r\n
Response "HTTP1.1 400 Illegal character SPACE=''\r\n"
2. example
GET /somepath/somepage.html
Server Running
HTTP/1.1\r\nAuthorization: Basic somestring=\r\n
Response HTTP/1.1 400 Illegal character VCHAR='/'\r\n
This example was working on older jetty version
3.example
GET /somepath/somepage.html
Server Running
\r\nHTTP/1.1\r\nAuthorization: Basic somestring=\r\n
Response HTTP1.1 400 Header Folding\r\n
Any ideas?
try the solution on the article https://support.citrix.com/article/CTX117142
edit to add more context: the article describes how to create a monitor for a back end server that requests basic authentication with a user name and password.
Summarized:
add lb monitor test_login_tcp TCP-ECV -send "GET / HTTP/1.1\r\nAuthorization: Basic YOURBASE64USERPW\r\nHost: IP_or_FQDN\r\n\r\n" -recv 200 -LRTM ENABLED

AT commands Quectel MC60

I've just started working with the Quectel MC60 and I am having some issues:
About HTTP GET method, I make the following commands:
AT+QIFGCNT=0
AT+QICSGP=1,"my_apn"
AT+QIREGAPP
AT+QIACT
AT+QSSLCFG="https",1
AT+QHTTPURL=39,40
my_url_39_bytes_long
AT+QHTTPGET=60
AT+QHTTPREAD=30
AT+QIDEACT
When using the QCOM software, I make a script running all the above commands sequentially. When it comes to the AT+QHTTPREAD command, the response is always "+CME ERROR: 3822" (HTTP response failed). What can it be? I'm sure the HTTP server is working properly.
The answer is that it is necessary to configure the request header
AT+QIFGCNT=0
AT+QICSGP=1,"my_apn"
AT+QIREGAPP
AT+QIACT
AT+QHTTPURL=39,40
my_url_39_bytes_long
AT+QHTTPCFG="requestheader",1
AT+QHTTPPOST=77
GET path HTTP/1.1
User-Agent: Fiddler
Host: www.my_host.com
AT+QHTTPREAD=30
AT+QIDEACT
NOTE: in AT+HTTPPOST=77, 77 is the size of the POST message (last two \r\n are required and count)
NOTE2: after GET you're supposed to write the path to the url inserted in AT+QHTTPURL. For example, if you specified your URL as https://www.my_host.com/debug/main/port, your AT+HTTPPOST request should look like this (don't forget the last two \r\n):
GET /debug/main/port HTTP/1.1
User-Agent: Fiddler
Host: www.my_host.com

GeoServer times out (504 Gateway Time-Out) when accessed from OpenLayers via nginx webserver

I have developed an OpenLayers web app that uses GeoServer. I am using nginx as my webserver with proxy_pass setup for GeoServer. Everything works as expected when I use "localhost" but when I switch to my IP address I get a 504 Gateway Time-Out error for
http://98.153.141.207/geoserver/cite/wfs.
I can access GeoServer at
http://98.153.141.207/geoserver/web
via a browser without problem so it would appear the proxy continues to work as expected.
The GeoServer log shows this when the problem occurs:
Request: describeFeatureType
service = WFS
version = 1.1.0
baseUrl = http://98.153.141.207:80/geoserver/
typeName[0] = {http://www.opengeospatial.net/cite}MyLayer
outputFormat = text/xml; subtype=gml/3.1.1
Then after a minute, I get the 504 Gateway Time-Out in my JavaScript console and this shows up in the GeoServer log:
09 May 06:02:15 WARN [geotools.xml] - Error parsing: http://98.153.141.207/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:MyLayer
I have tried this supposed problem URL in a browser and it works fine.
The nginx erorr log contains this:
2013/05/09 06:02:15 [error] 420#3844: *54 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while reading response header from upstream, client: 98.153.141.207, server: localhost, request: "GET /geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:MyLayer HTTP/1.1", upstream: "http://127.0.0.1:8080/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:MyLayer", host: "98.153.141.207"
Further investigation reveals that this problem seems to be restrict to WFS layers only. The WMS layers work fine. Here is the declaration of my WFS layer that fails:
myLayer = new OpenLayers.Layer.Vector("MyLayer",
{
strategies: [new OpenLayers.Strategy.BBOX(),saveStrategy],
projection: "EPSG:2276",
protocol: new OpenLayers.Protocol.WFS(
{
version: "1.1.0",
url: "http://" + hostip + "/geoserver/cite/wfs",
featureNS: "http://www.opengeospatial.net/cite",
srsName: "EPSG:2276",
featureType: "MyLayer",
geometryName: "Poly",
schema: "http://" + hostip + "/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:MyLayer"
})
});
Any help would be appreciated. Thanks
I managed to get this working by remove the "schema" property from the OpenLayer.Protocol.WFS of my layer. Can anyone explain why this would be the problem?

Resources