mangento 2 admin page redirect too many times error

The magento store was running fine after I initially configured, I can go to the backend and change the configurations with SSL on.

Suddenly when I tried to access the backend again later, it showed me this error on firefox, it showed the similar error on chrome also

The solution is configure the secure/use_in_adminhtml to 1, 

SELECT * FROM core_config_data where path like '%web/secure/use_in_adminhtml%';

If no entry is returned, it just means the configuration is not set.

Then do

INSERT INTO core_config_data (scope,scope_id,path,value) VALUES ('default',0,'web/secure/use_in_adminhtml',1)

Clear the cache

php bin/magento cache:flush

After that, everything is working again.