But how do you use dynamic value for port if you get port value from redirect? Right now it's 443, but it's possible that could change in the future. As Scott mentioned, you could extract from headers but that would make it two requests to work?
Assuming the port won't change from 443, I assume you could do a dynamic condition if/else check if protocol is HTTP vs HTTPS and if the latter, set to port 443 otherwise 80, but how would you write that? And would that only work for original request or will it also do a 2nd lookup/check against the new redirected URL when original request is made? On Mon, Nov 19, 2012 at 2:48 PM, Deepak Shetty <[email protected]> wrote: > two samplers arent needed - you could use dynamic values in the port field > (not tested in latest versions) > > ${__property(run.server.port,,80)} > > > On Mon, Nov 19, 2012 at 2:33 PM, HUSSEY, SCOTT T <[email protected]> wrote: > > > You could build two different samplers and extract the redirect from the > > header if the address is dynamic. > > > > > -----Original Message----- > > > From: David Luu [mailto:[email protected]] > > > Sent: Monday, November 19, 2012 4:27 PM > > > To: JMeter Users List > > > Subject: Re: How to force the port to be used in an HTTP Sampler? > > > > > > It's not totally clear from the original email, but I'm assuming the > > > sampler was originally requesting an HTTP url on port 80 (specified > > > specifically in port field or left at default). > > > > > > And the result of the request causes a redirect to HTTPS with specific > > > addition of port 443 in URL, and that the HTTP sampler simply follows > the > > > redirect to HTTPS at given URL but doesn't append port 443, causing the > > > failure. > > > > > > If you manually set port to 443 in the port field for the sampler, > > wouldn't > > > that cause the original request to change from > > > > > > http://originalUrl > > > > > > to > > > > > > http://originalUrl:443 > > > > > > which could then cause a problem w/o redirecting, because server is > > > expecting port 80 instead at this point of the process? But of course, > if > > > the original URL was already HTTPS and on 443 (default) then that > > wouldn't > > > be a problem. > > > > > > On Mon, Nov 19, 2012 at 11:11 AM, sebb <[email protected]> wrote: > > > > > > > On 19 November 2012 18:18, Taoism <[email protected]> wrote: > > > > > Hi all, > > > > > > > > > > I am having an issue with a SSO system. > > > > > > > > > > If I do a recording following redirects at one point the system > > sends a > > > > > response headers with a redirect URL like so: > > > > > > > > > > https://domain:443/blah/SSO?qsStuff > > > > > > > > > > (Note the use of both https and the default 443 port in the URL). > > > > > > > > > > The HTTP Sampler will not add the 443 to the URL being sent to the > > next > > > > > server (personally I don't think it should have to). If the port > is > > > > omitted > > > > > and just https://domain/blah is used I get an Internal error from > > the > > > > > server. Adding the port allows the SSO process to continue. > > (Discovered > > > > by > > > > > manually copying the response redirect and pasting into a browser). > > > > > > > > > > Is there any way to force the HTTP Sampler to include the port when > > it > > > > makes > > > > > the request even though it is technically redundant in this > instance? > > > > > > > > Just provide the port on the sampler GUI. > > > > > > > > > Cheers! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > View this message in context: > > > > http://jmeter.512774.n5.nabble.com/How-to-force-the-port-to-be-used- > > > in-an-HTTP-Sampler-tp5715344.html > > > > > Sent from the JMeter - User mailing list archive at Nabble.com. > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: [email protected] > > > > > For additional commands, e-mail: [email protected] > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [email protected] > > > > For additional commands, e-mail: [email protected] > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > >
