Starcounter
HomeDownloadDocsCommunity
2.3.1
2.3.1
  • Starcounter Documentation
  • Getting Started
  • Starcounter
    • Collapsing the Stack
      • Complexity and Scalability Tradeoff
      • The Future of Micro-Services
      • 10 Benefits of Collapsing the Stack
    • Integrated Database and Web Server
  • Hello World - Tutorial
    • Create a Database Class
    • Create a Real Time UI
    • First Interactive UI
    • Computed Properties
    • Expense Tracker
    • Cancel and Delete
    • The Next Step
  • Guides
    • Database
      • Database Classes
      • Data manipulation
      • Object Identity and Object References
      • Querying with SQL
      • Data Types
      • Relations
      • Inheritance
      • Sharing data
      • Database Configuration
      • Comparing Database Objects
      • Referential Integrity and Constraints
    • SQL
      • Identifiers
      • Path Expressions
      • Data operators
      • Joins
      • Aggregates
      • Comparisons and Logical Operators
      • Sorting
      • Fetch
      • Offset Key
      • Indexes
      • Literals
      • Query Plan Hints
      • Reserved words
      • Query for Database Classes
      • SQL Isolation Between Applications
    • Transactions
      • Short-Running Transactions
      • Long running transactions
      • Using Transactions
      • Running Background Jobs
      • Commit Hooks
    • Typed JSON
      • JSON-by-example
      • Code-Behind
      • Data Bindings
      • Callback Methods
      • Responding with JSON
      • Accepting JSON in Requests
      • Primitive Arrays and Single Value Types
      • Typed JSON Internals
    • Blendable Web Apps
      • Starcounter MVVM
      • Palindrom
      • Client-Side Stack
      • Sessions
      • HTML Views
      • App Shell
      • Web Components
      • View Attaching
      • View Composing
      • HTML Compositions
      • HTML Views Blending Guidelines
      • Avoiding CSS conflicts
      • Debugging
    • Network
      • HTTP
      • Internal Self Calls
      • Middleware
      • Anonymous or Substitute Handlers
      • URL Aliases and Redirects
      • Network Gateway
      • Static File Server
      • External HTTP Calls
      • WebSocket
      • Avoiding URI conflicts
      • TCP Sockets
      • UDP Sockets
    • Publishing Apps
    • Working with Starcounter
      • Release Channels
      • Starting and Stopping Apps
      • Administrator Web UI
      • Star CLI
      • StarAdmin CLI
      • StarDump CLI
      • Working in Visual Studio
      • Error Log
      • Using HTTPS on NGINX
      • Using HTTPS on IIS
      • Run Starcounter in Production
      • Weaver
      • Investigating App Crashes
      • Configuration Structure
      • Database Refactoring
      • Using Unload/Reload to Modify Database Schema
      • Kernel Questions and Answers
      • Log Files
  • Cookbook
    • Attach an HTTP Request to an Existing Long-Running Transaction
    • Cookie-Based Authentication
    • Timestamp on Object Creation
    • Creating Strongly Typed JSON Collections
    • Migrating From 2.2 to 2.3+
    • Multiple Pages
    • Icons
    • Proposed Project Structure
    • Acceptance Testing with Selenium
    • Requesting a User to Authenticate
    • How to delete unused tables and columns
Powered by GitBook
On this page
  • Introduction
  • Configuration
  • WorkersNumber
  • MaxConnectionsPerWorker
  • MaximumReceiveContentLength
  • InactiveConnectionTimeout
  • Big size Uploads
  • Reverse Proxy Functionality
  1. Guides
  2. Network

Network Gateway

Introduction

The network gateway is a key network communication component of Starcounter. The scnetworkgateway.exe process, which is separated from the database, represents the network gateway. It handles all external communications with the code-host, as well as communication between different code-hosts on one machine.

The gateway process talks to the codehost process (sccode) through shared memory. The same way codehost process is also separated from database process (scdata) and talks to it through shared memory. There is no direct connection between gateway and scdata, only through sccode. Network gateway parses network traffic, and prepares "messages" that are delivered to sccode through shared memory and executed there. The responses from sccode go back through the same shared memory to gateway, which sends them outside.

Detailed network gateway configuration and statistics can be retrieved using GET /gw/stats on system port (by default 8181).

Configuration

Network gateway is configured in scnetworkgateway.xml, which is located in the server repository (e.g User/Documents/Starcounter/Personal). Here are some notable configuration options:

WorkersNumber

Is the number of gateway worker threads. Normally this value should be 1-2. On high loads, this value can be increased.

MaxConnectionsPerWorker

Is the maximum number of connection per each gateway worker. Connections are equally distributed between workers.

MaximumReceiveContentLength

Is the maximum size of incoming HTTP body/content, in bytes. Requests with bigger bodies are rejected with 413 Request Entity Too Large and closure of TCP connection.

InactiveConnectionTimeout

Is the inactive HTTP connections life time in seconds. Inactive connections are those on which send/receive are not performed.

Big size Uploads

Since the network gateway supports limited size uploads, the user has to write a custom big-data uploader for both HTTP and WebSocket protocols.

Reverse Proxy Functionality

Starcounter gateway provides basic reverse proxy functionality based on HTTP Host header in requests. Reverse proxies are defined in ReverseProxies section of gateway configuration. Here is an example of reverse proxy that redirects all incoming HTTP requests on port 80, with Host header equals "www.example1.sc", to service on localhost and port 8080:

<ReverseProxy>
  <DestinationIP>127.0.0.1</DestinationIP>
  <DestinationPort>8080</DestinationPort>
  <StarcounterProxyPort>80</StarcounterProxyPort>
  <MatchingHost>www.example1.sc</MatchingHost>
</ReverseProxy>
  • DestinationIP: IP address of destination server, to which proxied requests are redirected.

    or

  • DestinationDNS: DNS name of destination server, to which proxied requests are redirected.

  • DestinationPort: port address of destination service.

  • StarcounterProxyPort: Starcounter gateway port on which requests that should be proxied are received.

  • MatchingHost: HTTP Host header value to filter out requests to be processed by this proxy.

In the example above when HTTP request with Host header www.example1.sc comes on port 80 its automatically transferred to port 8080 on localhost.

You can see current configuration for reverse proxies by calling GET /gw/stats on system port.

To apply current gateway configuration (URI aliases and reverse proxy configuration) from scnetworkgateway.xml one should call GET /gw/updateconf on system port. If errors occur applying new changes - the previous configuration is kept.

PreviousURL Aliases and RedirectsNextStatic File Server

Last updated 7 years ago