Browserstack logo
  • AI Agents
  • Pricing
  • Manual Testing

    Live

    Cross-browser testing

    Testing Toolkit

    Essential manual testing tools

    Accessibility Testing

    Test WCAG compliance

    Website Scanner

    All-in-one website checker

    Test Automation

    Automate

    Browser automation grid

    Low Code Automation

    Automation without coding

    Accessibility Automation

    Automate WCAG testing

    Percy

    Visual testing & review

    Automate TurboScale

    Automation on your Cloud

    Management & Optimization

    Test Management

    Unify & track all test cases

    Test Reporting & Analytics

    Monitor & optimize all tests

    Explore BrowserStack for Enterprise | Bug Capture | Requestly | Private Devices

    Manual Testing

    App Live

    Real device testing

    App Accessibility Testing

    Test WCAG compliance

    Test Automation

    App Automate

    Real device automation cloud

    App Percy

    Visual testing for mobile apps

    Management & Optimization

    Test Management

    Unify & track all test cases

    Test Reporting & Analytics

    Monitor & optimize all tests

    Explore BrowserStack for Enterprise | Bug Capture | Requestly | Private Devices

    • Documentation
    • Support
    • Status
    • Release Notes
    • Open Source
    • Events
    • Meetups
    • Champions
  • AI Agents
  • Pricing
  • Sign in
  • Free Trial
  • Manual Testing
  • Live
    Manual cross-browser testing
  • Accessibility Testing
    Super app to find & report issues
  • Test Automation
  • Automate
    Browser automation grid
  • Percy
    Visual testing & review
  • Management & Optimization
  • Test Management
    Unify & track all test cases
  • Test Reporting & Analytics
    Monitor & optimize all tests
  • For Teams
  • Enterprise
  • Manual Testing
  • App Live
    Manual real device testing
  • App Accessibility Testing
    Test WCAG compliance
  • Test Automation
  • App Automate
    Real device automation cloud
  • App Percy
    Visual testing for mobile apps
  • Management & Optimization
  • Test Management
    Unify & track all test cases
  • Test Reporting & Analytics
    Monitor & optimize all tests
  • For Teams
  • Enterprise
  • Documentation
  • Support
  • Status
  • Release Notes
  • Open Source
  • Events
  • Champions
  • Documentation
  • Developer tools
  • Integrations
  • Integration URL
  • Local testing
  • References
  • Features
  • Mobile Features
  • Test on Right Devices
  • Browsers & Devices
  • Security
  • Status
    Home Local Testing Tunnel Firewall

    In This Article

    • Include Hosts
    • Exclude Hosts

    Related Articles

    Local Testing with Live

    Local Testing with App-Live

    Local Testing with Automate

    Local Testing with App-Automate

    Flags for Local Binary

    Local Testing Internals

    Inbound IP Whitelisting

    Local Testing API

    Tunnel Firewall

    You can use Tunnel Firewall to control the resolution of your domains.

    Include Hosts

    Flag

    --include-hosts

    Description

    This flag provides granular control over the URLs that you want to tightly bind to your tunnel.

    Wildcards supported are: '*',  '?', '+', '.' 

    When you use this option, all domains bound to the tunnel will always be resolved via the tunnel, and no other domains will be resolved via the tunnel.

    This flag can be paired with force-local, and requests to all non tunnel bound URLs will fail.

    Note:

    1. This flag cannot be paired with --only, please use one or the other.
    2. If you are using this with Use my local IP for Google Analytics tracking, you need to add www.google-analytics.com in your include-hosts.

    Examples

    1. BrowserStackLocal --key YOUR_KEY --include-hosts "mywebsite.com”

      All traffic to mywebsite.com (all ports and both HTTP and HTTPS) will go through your tunnel. All other requests will be resolved via the public internet.

    2. BrowserStackLocal --key YOUR_KEY --include-hosts "localhost" ”127.0.0.1”

      All traffic to localhost and 127.0.0.1 (all ports and both HTTP and HTTPS) will go through your tunnel. All other requests will be resolved via the public internet. You can similarly extend the URL set with just a space-separated list of entries.

    3. BrowserStackLocal --key YOUR_KEY --include-hosts ”localhost” "127.0.0.1" "myinternalwebsite.*" ".*.browserstack.com" --force-local

      All traffic to localhost, 127.0.0.1, and any TLD for myinternalwebsite - such as myinternalwebsite.com or myinternalwebsite.net,and all subdomains for browserstack.com (all ports and both HTTP and HTTPS) will go through your tunnel. Requests to any URLs not covered by the four input patterns will fail, because --force-local ensures that no resolution happens via the internet, and your tunnel is only open to the URL patterns you supplied.

    4. BrowserStackLocal --key YOUR_KEY --include-hosts ".*”

      Functionally, this is the same as --force-local, but this flag can be paired with --exclude-hosts to fulfil some use-cases which can’t be accomplished with --force-local.

    Exclude Hosts

    Flag

    --exclude-hosts

    Description

    This flag supersedes --include-hosts. This flag provides granular control over the URLs that you want to disallow from your tunnel.

    Wildcards supported are: '*',  '?', '+', '.' 

    When you use this option, all domains disallowed from the tunnel will never be resolved via the tunnel, and other domains might be resolved via the tunnel depending on other parameters.

    This flag can be paired with --force-local, and will mean that all traffic will be resolved via your Local tunnel, except the domains blacklisted using this flag.

    Note: This flag cannot be paired with --only, please use one or the other.

    Examples

    1. BrowserStackLocal --key YOUR_KEY --exclude-hosts ".*.apple.com”

      Your tunnel will never be used to resolve any requests to an apple.com subdomain. However, all other URLs will follow the familiar path, where we try to resolve them via the public internet first, and then fall back to the tunnel.

    2. BrowserStackLocal --key YOUR_KEY --include-hosts ".*" --exclude-hosts ".*.google.com”

      Your tunnel will serve all URLs except google.com subdomains - those will be resolved via the public internet.

    3. BrowserStackLocal --key YOUR_KEY --exclude-hosts ".*.bing.com” --force-local

      Your tunnel will never be used to resolve any requests to a bing.com subdomain. However, all other traffic will go through your tunnel. Requests to*.bing.com will fail, because --force-local will ensure that no URL is resolved from the public internet.

    4. BrowserStackLocal --key YOUR_KEY --include-hosts ".*.microsoft.com" ".*.google.com" ".*.amazon.com" --exclude-hosts "www.amazon.com" --force-local

      Your tunnel will resolve subdomains from microsoft.com, google.com, and amazon.com. Your tunnel will, however, not resolve any requests to www.amazon.com. All requests to www.amazon.com, along with all other requests not explicitly bound to the tunnel, will fail because --force-local will ensure that no resolution happens from the public internet.

    PRODUCTS

    • Live
    • App Automate
    • App Live
    • Automate
    • Accessibility Testing
    • Low Code Automation
    • Percy
    • App Accessibility Testing
    • Accessibility Automation
    • Test Management
    • Test Reporting & Analytics
    • App Percy
    • Automate TurboScale
    • Bug Capture
    • Requestly
    • Website Scanner
    • Testing Toolkit

    WHY BROWSERSTACK

    • Customers
    • Case Studies
    • AI Agents
    • Browsers & Devices
    • Enterprise
    • Data Centers
    • Real Device Features
    • Security

    RESOURCES

    • Support
    • Status
    • Release Notes
    • Blog
    • Events
    • Community
    • Meetups
    • Champions
    • Guide
    • Partners
    • Find a partner
    • Trust Center
    • Test University (Beta)

    COMPANY

    • About Us
    • Careers
    • Open Source
    • Press
    • Newsletter
    Browserstack logo
    SOCIAL
    twitter social link facebook social link linkedin social link youtube social link instagram social link discord social link
    Contact Us

    We are available 24 / 7

    More Resources

    Cross Browser Testing Selenium Testing Test Management Emulators vs Real Device Mobile App Testing

    Test on Device

    Test on iPad Test on Galaxy Test In IE Test on Android Test on iOS Mobile Emulators Test on Right Devices

    Tools

    SpeedLab Screenshots Responsive Nightwatch.js
    discord social link
    Contact Us

    We are available 24 / 7

    © 2025 BrowserStack. All rights reserved.

    • Terms of Service
    • Privacy Policy
    • Cookie Policy
    • Sitemap