snowflakedb/snowflake-jdbc

SNOW-1511475: nonProxyHosts not honoured correctly

Closed this issue · 2 comments

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of JDBC driver are you using?
    3,13,34 -> 3.16.1

  2. What operating system and processor architecture are you using?
    Mac/Linux x86/ARM

  3. What version of Java are you using?
    17

  4. What did you do?
    When using proxy configuration (either via java option or the jdbc url) nonProxyHosts parameter is not interpreted correctly.
    jdbc:snowflake://account_name.snowflakecomputing.com/?db=XXX&role=SYSADMIN&useProxy=true&proxyHost=proxy.example.com&proxyPort=443&nonProxyHosts=account_name.snowflakecomputing.com.
    This configuration will NOT bypass the proxy despite having the host set in nonProxyHosts. In order for it to work, you need to configure it with a *: jdbc:snowflake://account_name.snowflakecomputing.com/?db=XXX&role=SYSADMIN&useProxy=true&proxyHost=proxy.example.com&proxyPort=443&nonProxyHosts=*.snowflakecomputing.com

  5. What did you expect to see?

Proxy should be bypassed when specifying the full host in nonProxyHosts and not only with *.domain.

  1. Can you set logging to DEBUG and collect the logs?

    https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

  2. What is your Snowflake account identifier, if any? (Optional)

Hey @jeromartin,

FYI I edited your comment to replace the actual hostname with an example hostname.

I'm pretty certain that the nonProxyHosts option works from my recent testing when building out another feature. I think your issue is that you're using the hostname account_name.snowflakecomputing.com and starting with version 3.13.25 we replace all underscore characters with a hyphen, so really your JDBC driver is making a connection to the host account-name.snowflakecomputing.com which is why in your case it only works when you configure the nonProxyHosts parameter to bypass everything under the snowflakecomputing.com domain. You can change the behavior by changing the value of the allowUnderscoresInHost to true.

Try either:

1.) Using the hostname account-name.snowflakecomputing.com in the nonProxyHosts parameter

or

2.) Add the connection parameter:
allowUnderscoresInHost=true

Please give that a try and let me know if that helps.

Hey @sfc-gh-wfateem ,

Thank you for the information! It is indeed doing the trick, both allow the nonProxyHosts to be applied correctly.