Why HTTPS enforcement needs more than a redirect
HTTPS enforcement helps a website keep visitors on an encrypted connection. A redirect from an unencrypted address is useful, but it may happen only after the browser has already made an unprotected request. HTTP Strict Transport Security, usually shortened to HSTS, lets the website tell compatible browsers to use HTTPS for future connections and reject certain connection errors.
What is HTTPS enforcement?
HTTPS encrypts the connection between a browser and a website. Enforcing its use means addressing how visitors arrive, which links the application generates and what the browser remembers about the site.
A redirect tells a visitor who has reached an unencrypted address to move to an encrypted one. An HSTS policy changes future browser behaviour: after receiving a valid policy over HTTPS, the browser upgrades relevant requests before sending them.
The policy has a lifetime and can optionally cover subdomains, which are addresses beneath the main domain. Its scope needs to match the business's actual services.
A separate browser preload list can cover an initial visit. Setting a preload instruction alone does not place a website on that list or remove the need to meet its requirements.
Why it matters
Consider a staff member opening an old unencrypted bookmark for a supplier portal while using a network the business does not control. Without a policy already known to the browser, an initial unencrypted request may still occur.
Someone able to observe or interfere with that network connection could affect the unprotected part of the journey. A remembered HSTS policy lets the browser begin with the encrypted connection instead.
The protection has limits. A normal policy is learned after a valid HTTPS connection, unless an existing browser policy or preload entry already covers the visit. It also does not correct insecure settings elsewhere in the application.
TLS security remains important because it governs the encrypted connection itself. A transport policy cannot compensate for an unsuitable certificate or an unsupported encryption configuration.
How penetration testers check for it
- Review the website's use of encrypted connections, redirects and generated links across representative public and signed-in areas.
- Inspect the HSTS response header over HTTPS, assessing whether its lifetime and scope are valid and consistent with the intended deployment.
- Distinguish behaviour for a browser that already knows the policy from an initial visit, including any relevant confirmed preload coverage.
- Review subdomain dependencies and certificate arrangements before recommending a wider or longer-lasting policy, so the proposed change fits the organisation's services.
How to fix it
- Provide working HTTPS with suitable certificates for every relevant service. Update application links and redirect unencrypted website requests to the correct encrypted address.
- Configure the Strict-Transport-Security header on HTTPS responses with a suitable lifetime. Verify its delivery through the public hosting and content-delivery layers.
- Check all affected services before extending the policy to subdomains. Introduce changes in a controlled rollout and confirm that legitimate users can still connect.
- Assess preloading separately where appropriate. Follow the browser list's current requirements and plan ongoing certificate maintenance before making a commitment that is slower to reverse.
Retest browser behaviour after rollout and monitor certificate expiry. A policy that relies on secure connections also relies on the business keeping those connections available and correctly maintained.
Related issues
- Web server configuration mistakes that expose your data
- Implementing secure application login flows
- Auditing TLS protocols, certificates and encrypted connections
Read about our methodology or contact pentested.com to discuss testing for your website.