baseUrl hostname eager resolution with proxy

Hello,

I am trying to run the gatling test on a complex docker env instantiating a cluster application that works together with a proxy. We have this http protocol

			http
				.baseUrl("https://cb-start:8443")
				.inferHtmlResources(AllowList(), DenyList(""".*\.js""", """.*\.css""", """.*\.gif""", """.*\.jpeg""", """.*\.jpg""", """.*\.ico""", """.*\.woff""", """.*\.woff2""", """.*\.(t|o)tf""", """.*\.png""", """.*\.svg""", """.*detectportal\.firefox\.com.*"""))
				.userAgentHeader("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36")
				.proxy(Proxy(localhost, 8889)
					.httpsPort(8889)
				)
				.perUserKeyManagerFactory { _ =>
					keyManagersFactories(incrementer.getAndIncrement() % keyManagersFactories.length)
				}

In the end gatling says:

16:06:02.527 [DEBUG] i.g.h.c.BaseUrlSupport$ - Couldn’t pre-resolve hostname from baseUrl
https://cb-start:8443
java.net.UnknownHostException: No such host is known (cb-start)

When I try to reach this containe via the browser the host-name appears like this:
image

Could it be that gatling is not considering the full hostname as cb-start:8443? Or should we look to docker files that deploy this env?

Thanks,
Emir

cb-start:8443 is not a hostname. cb-start is the hostname, whose IP addresses will be resolved with a DNS resolution. 8443 is the remote socket port.

Your issue is that the DNS resolution fails. I guess your DNS resolution relies on a DNS Search domain list or some etc/hosts entries, which are not configured on your load generators.

Note: you can also bypass DNS resolution, see https://docs.gatling.io/reference/script/protocols/http/protocol/#hostnamealiases

@slandelle

I understand this, but the IPs are hidden behind the Proxy. It seems I can’t directly map the host to a IP to skip DNS resolution.

Is this a valid way of thinking:

Gatling first tries to reach (as suggested by the term pre-resolve in the error message) https://cb-start:8443, but it doesn’t yet take the proxy into account. This causes a DNS error because we are not setting up the proxy in time

?

Ahhhh, OK.

Fixed: HTTP: Only pre-resolve baseUrl DNS when not using a proxy · Issue #4547 · gatling/gatling · GitHub

Thanks for reporting.

1 Like

@slandelle this bugfix will be in gatling 3.11 right?

Yes, 3.11.0. ETA ~ 2-3 weeks

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.