Solved

How do I allow restricted headers with HTTP Client?

  • 26 October 2021
  • 1 reply
  • 4497 views

Userlevel 6
Badge +3
  • Senior Technical Evangelist and Developer Advocate at Snowflake
  • 67 replies

I'm running SDC in a Docker container and I am trying to invoke a HTTP call with HTTP Client using a restricted header like below:

curl -X GET -H "Host: my-host" http://my-service/my-endpoint

 

However, by default the header is ignored with the following warning:

HttpUrlConnector - Attempt to send restricted header(s) while the [sun.net.http.allowRestrictedHeaders] system property not set. Header(s) will possibly be ignored

Where do I set this property? Adding it to SDC config did not help.

icon

Best answer by Dash 26 October 2021, 22:53

View original

1 reply

Userlevel 6
Badge +3

You need to set the SDC_JAVA_OPTS environment variable which gets passed to the JVM. You can do so from docker run like this:

docker run --env SDC_JAVA_OPTS="-Dsun.net.http.allowRestrictedHeaders=true" ...

 

Reply