GitHub user FrancescoCastaldi added a comment to the discussion: Database 
connection: proxy in front of solr

The error `ERROR: Expecting value: line 1 column 1 (char 0)` is a Python 
`json.decoder.JSONDecodeError`. It occurs when `solr-sqlalchemy` sends an HTTP 
request expecting a JSON response from Solr, but the server (in this case, Knox 
Gateway) returns an HTML document or an empty response (such as an HTTP 401/403 
authentication challenge or an HTML login redirect).

Between modifying `solr-sqlalchemy` for Kerberos vs Knox Gateway, using Knox 
Gateway is by far the cleaner and standard approach because Knox is explicitly 
designed to handle the Kerberos/SPNEGO authentication on the Hadoop/Solr side 
while offering simple HTTP Basic Auth to external clients like Superset.

Here is how to resolve the connection through Knox:

### 1. Fix the Knox Gateway URL Path Structure
Apache Knox topologies expose services under 
`/gateway/<topology_name>/<service_name>`.
Your connection URI should include the `/gateway/` path prefix:

```text
solr://username:[email protected]:443/gateway/europe-italy/team-tiramisu/solr/cheese_collection
```

If your Knox topology is mapped with SSL on port 443, ensure `use_ssl=true` is 
passed so requests use `https://` instead of `http://`.

### 2. Configure Engine Parameters and SSL Verification in Superset
In Superset, go to **Settings -> Database Connections -> Edit -> Advanced -> 
Other**, and configure the **Engine Parameters** with proper HTTP headers and 
SSL certificates:

```json
{
  "connect_args": {
    "scheme": "https",
    "verify_ssl": true
  }
}
```

### 3. Verify the Knox Endpoint Directly via cURL
Before testing in Superset, verify from the Superset server shell that Knox is 
accepting your Basic Auth credentials and returning valid Solr JSON:

```bash
curl -k -u "username:password" \
  
"https://my.knox.vip.com:443/gateway/europe-italy/team-tiramisu/solr/cheese_collection/select?q=*:*&wt=json";
```

If this returns an HTML page containing "Knox Authentication Failed" or a 302 
redirect, check your Knox service role permissions for the `solr` service in 
that topology. Once cURL returns a raw JSON object starting with `{ 
"responseHeader": ... }`, the SQLAlchemy Solr driver will connect successfully.


GitHub link: 
https://github.com/apache/superset/discussions/40727#discussioncomment-19164774

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to