'JMeter: How to supply a hostname which contains a forward slash in JMeter user defined variables?
The hostname being supplied to the JMeter test plan, contains a forward slash and has been defined in the User defined variables section. However, each time the test is run, the following is seen in the response message:
Response message:Non HTTP response message: Illegal character found in host: '/'
The hostname provided: Jmetertest.com/test
Is there any way around this? Thanks in advance! :)
Solution 1:[1]
A DNS hostname cannot contain slash.
The Internet standards (Request for Comments) for protocols specify that labels may contain only the ASCII letters a through z (in a case-insensitive manner), the digits 0 through 9, and the hyphen-minus character ('-'). The original specification of hostnames required that labels start with an alpha character, and not end with a hyphen
So you need to split hostname from the URL Path
i.e. in the following URL:
https://example.com/foo?bar=baz
https- the protocolexample.com- is the hostname/foois the path?bar=bazis the query string
In the HTTP Request sampler you can only have the following syntax:
If you put anything than allowed characters into "Server name of IP" field you will get an error.
Theoretically it's possible to put the full URL into the "Path" field like:
But in this case configuration elements like HTTP Cookie Manager may stop working.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dmitri T |


