# HTTPS Flow

![](https://3470531533-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJt73HdbsX25I3225DZBw%2Fuploads%2FuPd94GNI4EDqds5dxEEh%2Fimage.png?alt=media\&token=ac45e93f-4b53-4cfb-87e3-a7a69eeadd34)

When visiting a page that uses HTTPS:

1. Browser attempts to resolve the domain and redirects to the webserver.
2. The first request is sent to port 80, the server will notice this and redirect to port 443.  When this happens you will get a 301 Moved Permanently response code.
3. Client sends a "client hello" packet which gives information about itself.
4. Server responds with "server hello" and sends its SSL certificate.
5. The client will verify the key/certificate and then send its own.
6. Encrypted handshake is initiated, and encrypted communication can begin.

**Note:** Depending on the circumstances, an attacker may be able to perform an HTTP downgrade attack, which downgrades HTTPS communication to HTTP, making the data transferred in clear-text. This is done by setting up a Man-In-The-Middle (MITM) proxy to transfer all traffic through the attacker's host without the user's knowledge. However, most modern browsers, servers, and web applications protect against this attack. **(HTB)**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://scarecrow.gitbook.io/cyber-security/chapter-2-bug-bounty-basics/web-requests/http-fundamentals/https-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
