@Aishwarya Dixit
By Any chance do you have the Ranger and Ambari Server installed on the same host?
Because by chance iif the Ranger and Ambari are installed on the same host then Ambari might be redirecting the URLs of components like Ranger here from HTTP to HTTPS.
What strict-transport-security does?
When using SSL, this will be used to set the Strict-Transport-Securityresponse header.
HTTP Strict Transport Security (HSTS) is a security policy which is necessary to protect secure HTTPS websites against downgrade attacks. It also aids protection against cookie hijacking. It allows web servers to declare that web browsers should only interact with it using secure HTTPS connections, and never via the insecure HTTP protocol.
Browser knows the hostname (but it does not know in that host Ambari is running or Ranger) Ambari might be setting (it because ambari is set for SSL) that property to some age. But ranger does not want it as it is not set for ssl.
So when from the same browser you are hitting the Ranger ... because of same hostname it might be sending that header back.
Ambari 2.7 had some issue regarding setting those params to 0. But if you are using Older version of amabri then it should work fine.
https://issues.apache.org/jira/browse/AMBARI-25159
Hence i suggested you to try setting them to 0 in ambari.properties foillowed by AmbariServer restart (hit browser in incognito mode) , it works fine in 2.6.x versions. (by the way what is your ambari version)
http.strict-transport-security=max-age=0
views.http.strict-transport-security=max-age=0