The only way a proxy can act as a man-in-the-middle (assuming that the client and the server correctly implement a non-broken version of the SSL/TLS protocol, and that the certificate authorities do their job correctly) is if your browser trusts the proxy. That's because at the start of the connection, the client validates that the other endpoint has a valid certificate generated by a recognized certificate authority.
There may be a proxy between the client and the server. This is common on enterprise networks, for example, which often have no direct connection between inside hosts and the Internet. But the proxy can only exchange bytes back and forth. It cannot know, let alone modify, the content. It can know which IP address you're connecting to, but not which URL you're browsing.
So what can go wrong? If your browser recognizes a CA that is willing to sign that proxy.example.com
is the server that the client is trying to connect to, then proxy.example.com
can make its own connection to the server, and the client's connection may be visibly or transparently redirected to the proxy. Then the proxy is a man-in-the-middle.
Some enterprise networks configure all clients to trust the enterprise's own certificate authority, and impose a proxy that rewrites all SSL connections. The client then sees every site having a certificate signed by the enterprise's CA. Since all certificates have a valid signature, you won't notice this in everyday usage. The way to find out if this is happening (assuming the browser itself hasn't been tampered with, only its certificate list) is to check who signed a particular certificate, or to browse the list of trusted certificate authorities.