Specify host header and send request against IP
See original GitHub issueIs there a way to specify host header and send request against IP similar to this:
txheaders = { 'User-Agent': UA, "Host": nohttp_url }
robots = urllib2.Request("http://" + ip + "/robots.txt", txdata, txheaders)
Our main site has single IP and distinguish virtual sites via host header. There are multiple web servers behind load balancer. I need to run test against internal (particular web server) IP or external (load-balanced) IP
I guess, I can use custom DNS to map everything to IP I need, but workstation I run tests from is used for many other things…
Could somebody clarify why User-Agent header works, but Host is ignored, please? Is there another workaround without custom DNS?
I need smth. like:
locust --host=http://IP --no-web
h = {
"Host": "my.name.com",
"User-Agent":"locust",
}
self.client.get("/", headers=h)
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Host Header - What is an HTTP Host Header injection?
The HTTP host header is a request header that specifies the domain that a client (browser) wants to access. This header is necessary...
Read more >HTTP: Is an IP address allowed in the host header field?
So my first question is: If I program a HTTP server, should I implement a check, whether the client sends an IP address...
Read more >Host - HTTP - MDN Web Docs
The Host request header specifies the host and port number of the server to which the request is being sent.
Read more >How to add http host header in URL? - Server Fault
To get the first request the URL might be doom.myteams.myorg.net/https://myteams.myorg.net/config The Host should come from the URL and the GET ...
Read more >What Is a Host Header? - ITPro Today
Introduced in HTTP 1.1, a host header is a third piece of information that you can use in addition to the IP address...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try this.
I used to get 401 errors, while using python Locust for a load test- but wasn’t able to figure out how to send Authentication Type= Preemptive in the headers. But this clue helped and was able to figure out the solution.
h={‘Authorization’: ‘Basic PUTKEYHERE’} self.client.get("/<some api call uri> ", headers=h)
Thank you!