Skip to content

Why Django Redis does not raise exception while connecting to Redis Server with SSL param equal string "False" #717

Open
@phandc

Description

@phandc

Hi everyone,

I had encountered a problem recently.
When my server was trying to connect to the Redis Server, I made a mistake passing the SSL param to the string "False" rather than a boolean False param.
It prevented my server from receiving any requests.
When I tried to access http://localhost:8080 from a web browser or even try curl http://localhost:8080, it did not receive any responses. The server did not raise any exceptions.
When I changed the SSL param from string to boolean, my server could receive the incoming requests.
I thought that the wrong string param I passed kept my server and Redis Server in an infinite loop without a timeout.
It blocked the main Django app thread. Therefore, the server could not receive any requests.

Here is my wrong config

REDIS = {
    'tasks': {
        'HOST': 'localhost',
        'PORT': 6379,
        'USERNAME': '',
        'PASSWORD': '',
        'DATABASE': 0,
        'SSL': 'False', # False (bool) not 'False' string.
        # Set this to True to skip TLS certificate verification
        # This can expose the connection to attacks, be careful
        # 'INSECURE_SKIP_TLS_VERIFY': False,
        # Set a path to a certificate authority, typically used with a self signed certificate.
        # 'CA_CERT_PATH': '/etc/ssl/certs/ca.crt',
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions