Secure web gateway

Also known as: SWG

On this page 7

A secure web gateway (SWG) is a security control that sits between users and the internet and inspects outbound web traffic to enforce an organization’s acceptable use and threat protection policies. In infrastructure defense, a core area of cybersecurity, the SWG protects people while they browse: it blocks malicious and unwanted destinations, scans downloads for malware and prevents sensitive data from leaving through web channels.

Unlike a perimeter firewall, which reasons mainly about addresses, ports and protocols, an SWG understands web semantics: URLs, domain categories, HTTP methods, file types and, after decryption, the content of HTTPS sessions. It can run as an on-premises proxy appliance, as a cloud service or as a hybrid of both.

How a secure web gateway processes traffic

A secure web gateway works as a policy enforcement proxy for HTTP and HTTPS. Each request passes through a sequence of checks, and the gateway either forwards it, modifies it, warns the user or blocks it. The decision combines user identity, device context, destination reputation and the content itself.

Traffic reaches the gateway in several ways. An explicit proxy is configured in the browser or through a PAC file, a transparent proxy intercepts traffic at the network level, and a cloud SWG usually receives traffic from a lightweight endpoint agent or an IPsec or GRE tunnel from the branch office. The table below summarizes the main inspection stages.

StageWhat it checksTypical action
AuthenticationUser and group identityApply the matching policy
URL filteringDomain category and reputationAllow, warn or block
TLS inspectionDecrypted HTTPS contentExpose payload to further engines
Malware scanningFiles and scripts in transitBlock or sandbox
Data loss preventionUploads and form postsBlock or log sensitive data
Application controlSpecific web apps and functionsRestrict actions such as uploads
Typical inspection stages in an SWG

Core capabilities and deployment models

Modern gateways bundle several security engines behind one policy. Beyond categorization, they use threat intelligence feeds, signature and heuristic antivirus, sandbox detonation for unknown files, and sometimes remote browser isolation, which renders risky pages in a remote container and sends only safe visual output to the user.

The choice of deployment model has a strong effect on coverage, latency and operations. The following table compares the three common options.

ModelStrengthsWeaknesses
On-premises applianceFull control, data stays localRemote users must backhaul traffic
Cloud SWGProtects users anywhere, elastic capacityDepends on provider points of presence
HybridLocal inspection plus cloud coverageTwo policy sets to keep consistent
SWG deployment models

The shift to remote work has made the cloud model dominant. Cloud SWG is now commonly delivered as part of Security Service Edge (SSE), together with a cloud access security broker and zero trust network access, and as part of the broader SASE architecture when networking functions are added.

The SWG is often confused with neighboring controls because they overlap in function. The key distinction is direction and scope: an SWG protects users going out to the web, while a WAF protects applications receiving traffic from the web.

The comparison below shows where each control acts and what it is best at.

ControlTraffic directionPrimary focus
Secure web gatewayOutbound webUser browsing and downloads
Web application firewallInbound webAttacks on hosted applications
Next-generation firewallAll protocolsNetwork segmentation and app identification
DNS filteringOutbound DNSBlocking domains at name resolution
Secure email gatewayInbound and outbound mailPhishing and malicious attachments
How an SWG differs from neighboring controls

DNS filtering is lighter and works for every protocol, but it cannot see full URLs, file contents or user actions inside an allowed site. An SWG offers far more granular control, so many organizations combine both, with DNS filtering as a broad first layer.

Designing an effective SWG policy

Effective policy starts from risk and business need, not from the full category list. Most organizations block a small set of clearly dangerous categories, such as malware, phishing and newly registered domains, and apply warn or coach pages to gray areas rather than outright blocks.

The decision table below illustrates common policy choices.

SituationRecommended actionReason
Known malware or phishing domainBlockNo legitimate use
Newly registered domain, under 30 daysBlock or isolateHigh share of malicious sites
Personal cloud storage uploadAllow view, block uploadPrevents data exfiltration
Uncategorized siteWarn or isolateUnknown reputation
Banking and health sitesBypass TLS inspectionPrivacy and legal obligations
Example policy decisions
  • Deploy the gateway root certificate to managed devices before enabling TLS inspection.
  • Define decryption exemptions for certificate-pinned applications and regulated categories.
  • Forward logs to the SIEM so web events can be correlated with endpoint alerts from EDR.
  • Review blocked and warned events regularly to tune categories and reduce friction.

Limitations and operational risks

An SWG is only as good as its traffic coverage. Users on unmanaged devices, applications that ignore proxy settings and protocols such as QUIC over UDP 443 can bypass inspection unless the gateway or firewall forces fallback to TCP.

TLS inspection is the most demanding part. It adds latency, breaks applications that use certificate pinning, and makes the gateway a high-value target because it briefly holds decrypted traffic. Poorly configured gateways may also weaken encryption by accepting outdated cipher suites on the server side.

Finally, categorization is never perfect. Attackers host payloads on reputable cloud platforms and compromised legitimate sites, which pass URL filters easily. For that reason the SWG must be one layer among several, with endpoint protection and user awareness covering what it misses.

Stripped to the essentials

A secure web gateway is a checkpoint that every web request from an organization passes through. Before a page or file reaches an employee, the gateway looks at where it comes from and what it contains, and it stops anything dangerous or against company rules.

It works like a mail room that opens and checks packages before they reach desks. Most packages pass straight through, but suspicious ones are held back. The key point is that an SWG protects people while they browse, wherever they work.

Where it is applied

A professional services firm with 600 employees and mostly hybrid staff replaces its office proxy with a cloud secure web gateway. Laptops run an agent that steers web traffic to the nearest point of presence, so remote users receive the same policy as office users without a VPN.

The security team blocks malware, phishing and newly registered domain categories, enables TLS inspection except for banking and health sites, and allows personal cloud storage for viewing but blocks uploads of client files. Logs flow into the SIEM.

Three months later, an employee clicks a link in a convincing email that leads to a credential harvesting page created two days earlier. The gateway blocks the page as a newly registered domain, and the SIEM correlates the event with the email, allowing the team to purge the message from all mailboxes within an hour.