I have developed a module to make a custom menu to show thumpnail images of sub categories when hover the main menu or category.
For that in the Block of my module, I return the src of each thumpnail images using the following.
As it returns the url scheme as http always, checkout page is not completely secure. So I changed it to return secure url as below
Then it returns always https in it's url scheme.
I want https, only for checkout page since it needs to be secure, and http for other pages. How to solve it?