What a proxy is: enabling the explicit proxy
This lesson is open to everyone. The other lessons open with a package: sign in or sign up, then choose a package.
Key points
- A proxy is a go-between: the client talks to the proxy, and the proxy goes to the site in its own name, with a separate connection.
- A FortiGate has three different things: proxy-based inspection (an inspection method, lesson 13), the explicit proxy (the client knows the proxy) and the transparent proxy (the client does not).
- With an explicit proxy the browser is given the proxy's address and port (manually, with a PAC file or with WPAD). For HTTPS the browser sends
CONNECT site:443, so the FortiGate sees the site name without decrypting. - Enabling takes two steps:
status enableand a port underconfig web-proxy explicit; thenexplicit-web-proxy enableon the listening interface. - Once the proxy is on, nothing passes until a proxy policy is written. Proxy traffic is controlled by a separate proxy policy table, not by ordinary firewall policies.
What a proxy means
Normally a laptop connects to a site itself, and the FortiGate stands on the path forwarding (and inspecting) packets. With a proxy things are different: the laptop connects to the proxy, not to the site, and says "open this site for me". The proxy connects to the site separately, in its own name, gets the answer and returns it to the laptop.
Normal path: Laptop ───────────────────────────► Site With a proxy: Laptop ──► Proxy (FortiGate) ──► Site 1st connection 2nd connection
Because there are two separate connections, the proxy sees the request in full: which site, which address (URL), which method, which browser. That makes finer rules possible.
Three similar words, three different things
On a FortiGate the word "proxy" appears in three places, and beginners mix them up.
| What it is | Client setting | Where it is configured | |
|---|---|---|---|
| Proxy-based inspection | A policy's inspection method (lesson 13): the file is assembled in full and checked | None | inspection-mode proxy in a firewall policy |
| Explicit proxy | The FortiGate listens on a port as a proxy server | Yes: the proxy address is written in the browser | config web-proxy explicit + a proxy policy |
| Transparent proxy | Ordinary traffic is redirected to the proxy without the client knowing | None | A redirect in a firewall policy + a proxy policy (lesson 46) |
This unit is about the second and the third.
How an explicit proxy works
"Explicit" means openly stated: the client knows the proxy exists. The browser is told: "send all web traffic to port 8080 of 10.10.10.1".
When opening an HTTP site the browser sends the proxy a request like this:
GET http://numune.example/sehife HTTP/1.1 Host: numune.example
When opening an HTTPS site it first asks for a tunnel:
CONNECT numune.example:443 HTTP/1.1If the proxy allows it, it opens a TCP connection to the site and the browser starts the TLS handshake. An important detail: the CONNECT line contains the site name in clear text. So even without deep inspection the FortiGate knows which site is being visited and can decide on that. To see inside the page (full URL, files) deep inspection is still needed (lesson 14).
When you need it
| Situation | Why an explicit proxy |
|---|---|
| Servers must have no default route to the internet, yet must download updates | The server can reach only the proxy; the proxy lets it out only to allowed sites |
| Every web request must be tied to a user name | The proxy can ask the user for a name (lesson 45) |
| Many users leave from one IP (a terminal server) | The proxy can tell users apart by session instead of by IP |
| A rule must be written by site address, method or browser type | Proxy address objects (lesson 45) |
| Traffic must be passed on to another, upstream proxy | A forwarding server (lesson 45) |
In a simple office where everyone goes out through an ordinary policy, an explicit proxy is usually not needed: web filter and antivirus work in an ordinary policy too.
Enabling it
1. Make the feature visible. In the GUI: System > Feature Visibility > Explicit Proxy. If you work in the CLI, this step is not required.
2. Turn the proxy on and give it a port:
FGT-HQ # config web-proxy explicit FGT-HQ (explicit) # set status enable FGT-HQ (explicit) # set http-incoming-port 8080 FGT-HQ (explicit) # end
If you do not set a separate port for HTTPS, it is accepted on the same port (8080).
3. Say which interface it listens on:
FGT-HQ # config system interface FGT-HQ (interface) # edit "port2" FGT-HQ (port2) # set explicit-web-proxy enable FGT-HQ (port2) # next FGT-HQ (interface) # end
Enable it on an internal port only. Enabling the proxy on the WAN port means offering it to the whole internet.
GUI: Network > Explicit Proxy, then Network > Interfaces > port2 > Explicit web proxy.
At this point the FortiGate listens on 10.10.10.1:8080 but still passes nothing: that needs a proxy policy (next lesson).
How the browser learns about the proxy
| Method | How | When |
|---|---|---|
| Manual | The address and port are typed into the browser's or the system's network settings | A few computers, a server |
| PAC file | A small script: "use the proxy for these sites, go direct for those". The browser is given the file's address | Many computers, complex rules |
| WPAD | The browser finds the PAC file's address itself through DHCP or DNS | Large networks; settings distributed centrally |
The FortiGate can serve the PAC file itself:
FGT-HQ # config web-proxy explicit FGT-HQ (explicit) # set pac-file-server-status enable FGT-HQ (explicit) # end
The file is at http://10.10.10.1:8080/proxy.pac. In a domain environment the proxy settings are usually distributed with Group Policy.
Whom the site sees
The proxy connects to the site in its own name. So the site sees the FortiGate's outgoing address (203.0.113.2 in our case), not the laptop's. An explicit proxy needs no separate NAT setting.
Verifying
FGT-HQ # show web-proxy explicit FGT-HQ # diagnose wad session list
The simplest test on the client side:
curl -x http://10.10.10.1:8080 http://numune.example/| Result | Meaning |
|---|---|
| Connection refused | The proxy is not on, the port is wrong, or the interface has no explicit-web-proxy |
| The FortiGate's "Access Denied" page | The proxy works but there is no matching proxy policy (next lesson) |
| The page opens | The proxy and the policy are in place |
🧪 Hands-on lab · Device: FortiGate-VM
Enabling the explicit web proxy
Make the FortiGate an explicit web proxy for the LAN. 1) Under config web-proxy explicit write status enable and http-incoming-port 8080. 2) Enable it on the listening interface: set explicit-web-proxy enable under port2. After that a browser in the LAN can use 10.10.10.1:8080 as its proxy address (the proxy policy that allows traffic is the next task).
Checked:
- web-proxy explicit: status enable
- Port 8080
- port2: explicit-web-proxy enable
Check yourself
5 questions · answers are shown instantly · 3 correct answers complete the lesson
1With a proxy, who connects to the site?
2What separates an explicit proxy from a transparent proxy?
3How does the FortiGate see an HTTPS site's name on an explicit proxy without deep inspection?
4You wrote status enable under config web-proxy explicit, but the client cannot connect (connection refused). The most likely cause?
5Why must the explicit proxy not be enabled on the WAN port?
Comments
Sign in to comment.