[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jmeter-user
Subject:    Re: JMeter: how to override Host header
From:       Felix Schumacher <felix.schumacher () internetallee ! de>
Date:       2015-07-31 19:26:37
Message-ID: 55BBCBED.3080205 () internetallee ! de
[Download RAW message or body]

Am 31.07.2015 um 19:19 schrieb Deepak Shetty:
> You might want to file a bug or patch and see if HTTPClient works- In 2.13
> I see the code as always reading the port from URL rather than the host
> header specified-
I have filed a bug

https://bz.apache.org/bugzilla/show_bug.cgi?id=58201

Regards,
  Felix

> regards
> deepak
>
> Snippet from HTTPHC4Impl.java
> if (! HTTPConstants.HEADER_CONTENT_LENGTH.equalsIgnoreCase(n)){
>                          String v = header.getValue();
>                          if (HTTPConstants.HEADER_HOST.equalsIgnoreCase(n)) {
>                              int port = url.getPort();
>                              v = v.replaceFirst(":\\d+$",""); // remove any
> port specification // $NON-NLS-1$ $NON-NLS-2$
>   if (port != -1) {
>                                  if (port == url.getDefaultPort()) {
>                                      port = -1; // no need to specify the
> port if it is the default
>                                  }
>                              }
>
> request.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(v,
> port));
>
> On Fri, Jul 31, 2015 at 9:41 AM, Deepak Shetty <shettyd@gmail.com> wrote:
>
>>> I'm sure that I'm not a first person who tries to load-test ‘virtual
>> server' behind reverse/caching proxy and it is just a matter of time to
>>> find the solution for this.
>> We do have a reverse proxy for our app - and I either change my local
>> applications ports to match the real application or I setup a dummy reverse
>> proxy(because the reverse proxy has the URL rules for e.g. for SEO) that
>> allows me to use the same port (and swap out Hosts) - if I remember
>> correctly around Httpclient 3.x there wasn't a way to setup the port to be
>> different and you could do this in the Sun JDK by setting a couple of sun
>> specific headers if you were using the Sun implementation (but that would
>> need JMeter code change)
>> You probably need to see if this is possible in the latest versions of
>> HTTPClient - if yes then probably JMeter can be enhanced.
>>
>> On Fri, Jul 31, 2015 at 9:05 AM, Aliaksei Ilkiu <alexmsu@gmail.com> wrote:
>>
>>> Bob,
>>> I have few hundred requests and rewrite each of them as such low-level
>>> request is impractical.
>>> HTTP Header Manager provides standard facility to configure custom header
>>> Host.
>>> Apparently there is undocumented behavior that modifies this header and
>>> adds incorrect port.
>>> I'm sure that I'm not a first person who tries to load-test ‘virtual
>>> server' behind reverse/caching proxy and it is just a matter of time to
>>> find the solution for this.
>>>
>>> Aliaksei Ilkiu
>>> alexmsu@gmail.com
>>>
>>>
>>>
>>>> On Jul 31, 2015, at 9:55 AM, Bob <b.meliev@gmail.com> wrote:
>>>>
>>>> Try this plugin, it might help but not sure.
>>>>
>>>> http://jmeter-plugins.org/wiki/RawRequest/
>>>>
>>>> On 31/07/15 17:57, Aliaksei Ilkiu wrote:
>>>>> Hello Bob,
>>>>>
>>>>> Thanks for you feedback. It is already done: my server runs on IP
>>> 127.0.0.1 and port 9443.
>>>>> These values are set in HTTP Request Defaults (in HTTP Request these
>>> values are empty)
>>>>> Externally my server is available via https://myhost.com
>>>>> I'm running JMeter internally and want to keep it this way.
>>>>> In order to emulate external traffic I need to pass Host header with
>>> value 'myhost.com:443'.
>>>>> If I define such header in HTTP Header Manager the value gets replaced
>>> to 'myhost.com:9443'.
>>>>> I'm asking how can I configure Host header correctly.
>>>>> It was an old discussion about this
>>> http://jmeter.512774.n5.nabble.com/How-to-override-Host-header-td4295391.html
>>> but it was only about customizing hostname and that is works, what does not
>>> work is port customization.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>>>> For additional commands, e-mail: user-help@jmeter.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>>> For additional commands, e-mail: user-help@jmeter.apache.org
>>>
>>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic