jcustenborder / kafka-connect-solr

Kafka Connect connector for writing to Solr.
Apache License 2.0
43 stars 28 forks source link

Basic Authentication is missing in the first request #38

Open r00tvvm opened 4 years ago

r00tvvm commented 4 years ago

We're running Solr 8.4.1 with basic authentication enabled for all type of requests and paths. Next running Kafka Connect with kafka-connect-solr plugin installed and default solrj library replaced with solr-solrj-8.4.1.jar. Kafka-connect-solr plugin (HttpSolrSinkConnector) has been configured with solr.username, solr.password

{
  "name": "solr-sink-stage",
  "config": {
    "connector.class": "com.github.jcustenborder.kafka.connect.solr.HttpSolrSinkConnector",
    "solr.url": "https://test-solr:8983/solr/collection-test-kafkaconnect1",
    "tasks.max": "1",
    "topics": "topic1",
    "name": "solr-sink-stage",
    "solr.username": "user",
    "solr.password": "password"
  },
  "tasks": [
    {
      "connector": "solr-sink-stage",
      "task": 0
    }
  ],
  "type": "sink"
}

But the very simple test showing the first request is coming without Basic Authentication headers

/ # nc -lp 8983
POST /solr/collection-test-kafkaconnect1/update?wt=javabin&version=2 HTTP/1.1
User-Agent: Solr[org.apache.solr.client.solrj.impl.HttpSolrClient] 1.0
Content-Type: application/javabin
Transfer-Encoding: chunked
Host: test-solr:8983
Connection: Keep-Alive

Content

Expecting this commit to work but it seems not. https://github.com/jcustenborder/kafka-connect-solr/commit/036fe18f0d231e030a07d27c3268fa2af8d6226e

Is it possible to force kafka-connect-solr to do Preemptive Basic Authentication and add authentication headers to all requests including the first one?

ravipokuru commented 4 years ago

Even I am facing the same issue Error from server at https://solr:8983/solr: require authentication. @r00tvvm did you find any alternative solution?

r00tvvm commented 4 years ago

@ravipokuru we only managed it to work by switching to Zookeeper based configuration, which is not that elegant as it would be via HTTP.