Server Parameters

The following description uses the name as seen on the “Parameters” page.

HttpServicePortNumber

Purpose: This is the port number on which Swiftfire will listen for incoming HTTP requests.

Type: String, Portnumber

Default: 6678

Note: For general purpose servers this should be port 80. However for special purposes or multi-server-software systems this can be different.

Update: Changes take effect after the next Swiftfire restart.

HttpsServicePortNumber

Purpose: This is the port number on which Swiftfire will listen for incoming HTTPS requests.

Type: String, Portnumber

Default: 6679

Note: For general purpose servers this should be port 443. However for special purposes or multi-server-software systems this can be different.

Update: Changes take effect after the next Swiftfire restart.

MaxNofAcceptedConnections

Purpose: The maximum number of HTTP connection request Swiftfire can process simultaneously.

Type: Integer, Number

Default: 20

Note: Swiftfire creates this number of re-usable connection objects. When a client connection request is accepted, it will be assigned to a connection object. As long as the client connection lasts, this connection object can only be used by and for that client. Once a connection is terminated the connection object is freed and can be reassigned to a new client connection.

The number of connection objects should neither be too high, nor too low. If it is too low, users will often experience an “Unavailable” response. If the number is too high then the system may become sluggish when too many users try to use the system. The right number depends on system performance and site-characteristics.

The default number is 20, which should suffice in most cases. It is advised to change this number only if complaints of either kind (too slow / unavailable) are received.

Update: Changes take effect after the next Swiftfire restart.

MaxNofPendingConnections

Purpose: This is a low level network parameter. It is the ‘backlog’ of the Unix ‘listen’ call, see listen.

Type: Integer, Number

Default: 20

Note: While not entirely correct it is easiest to think of the parameter as the number of client requests that are kept waiting if all connection objects are in use (i.e. MaxNofAcceptedConnections). If more client requests than this arrive, they will be rejected immediately with something like “Service Unavailable”.

Update: Changes take effect after the next Swiftfire restart.

MaxWaitForPendingConnections

Purpose: This time is approximately the time between a user requesting a service (web page) and receiving a rejection due to a mild system overload instead. (Note that during heavy system overload the rejection is often immediate).

Type: Integer, Seconds

Default: 30

Note: This is the time-out for pending client connections. Once a client connection cannot be accepted with this amount of time the connection request will be rejected. The user will experience a kind of “Service Unavailable”.

Note that “Service Unavailable” thus does not mean that the service as such has stopped. It only means that there are too many requests for the server to handle.

Update: Changes take effect after the next Swiftfire restart.

ClientMessageBufferSize

Purpose: The size of the buffer used for the HTTP request that is received. If a clients sends more, data will be lost.

Type: Integer, Bytes

Default: 32 * 1024 (32 KByte)

Note: The size a connection object allocates for its message buffer. This number may need to be updated if a client can transfer a lot information to the server.

Update: Changes take effect after the next Swiftfire restart.

HttpKeepAliveInactivityTimeout

Purpose: Inactivity timeout for accepted HTTP requests that have their ‘keep-alive’ set to ‘true’.

Type: Integer, milliseconds

Default: 500

Note: -

Update: Changes take effect immediately for new connections.

HttpResponseClientTimeout

Purpose: The time Swiftfire will wait for a client to accept a response.

Type: Integer, Seconds

Default: 10

Note: -

Update: Changes take effect immediately for new connections.

AutoStartup

Purpose: Allows Swiftfire to transition to ‘running’ automatically after boot.

Type: Bool

Default: True

Note: If no domain is defined, an autostart will not have any effect.

Update: Changes take effect at the next boot of Swiftfire

DebugMode

Purpose: Has an impact on the amount of debug information generated, not used much.

Type: Bool

Default: False

Note: Not used much.

Update: Changes take effect immediately.

AslLogLevel

Purpose: Prevents the logger from writing information to the Apple System Log of information classified below this level.

Type: Int

Default: None (8)

Note: See Readme. Note that to receive information below NOTICE in the ASL some special setup has to be applied at the OS system level as well see: blogpost.

Update: Changes take effect immediately.

StdoutLogLevel

Purpose: Prevents the logger from writing information to stdout of information classified below this level.

Type: Int

Default: None (8)

Note: See Readme. Stdout is usually mapped to the terminal or when in Xcode to the Xcode console.

Update: Changes take effect immediately.

FileLogLevel

Purpose: Prevents the logger from writing information to the logfiles of information classified below this level.

Type: Int

Default: None (8)

Note: See Readme.

Update: Changes take effect immediately.

LogfileMaxNofFiles

Purpose: Sets the limit for the number of logfiles to be created.

Type: Int

Default: None (8)

Note: Logfiles have a maximum size. When a logfile grows beyond the maximum size a new logfile is started. Once the maximum number of logfiles is reached, the oldest logfile is deleted.

Update: Changes take effect immediately.

LogfileMaxSize

Purpose: Sets the size limit for a logfile. Once this limit is exceeded a new logfile will be created.

Type: Int

Default: None (8)

Note: Logfiles have a maximum size. When a logfile grows beyond the maximum size a new logfile is started. Once the maximum number of logfiles is reached, the oldest logfile is deleted.

Update: Changes take effect immediately.

CallbackLogLevel

Purpose: Prevents the logger from calling the callback target with information classified below this level.

Type: Int

Default: None (8)

Note: See Readme.

Update: Changes take effect immediately.

NetworkLogLevel

Purpose: Prevents the logger from sending information classified below this level to the network target.

Type: Int

Default: None (8)

Note: See Readme.

Update: Changes take effect immediately.

NetworkLogTargetAddress

Purpose: The IP Address to use for the logger network target.

Type: Int

Default: None (8)

Note: -

Update: Changes take effect immediately.

NetworkLogTargetPort

Purpose: The port number to use for the logger network target.

Type: Int

Default: None (8)

Note: -

Update: Changes take effect immediately.

HeaderLoggingEnabled

Purpose: When set to ‘true’, the headers of all HTTP requests will be logged in a file.

Type: Bool

Default: False

Note: This flag controls the header logging at server level. I.e. it will create a logfile with all HTTP headers that are received, for all domains. Since there is no limit to the total amount of disk space for the header logging, this feature should only be used incidentally, not permanently.

Update: Changes take effect immediately.

MaxFileSizeForHeaderLogging

Purpose: When the header log grows beyond this number a new logfile will be created.

Type: Integer (KBytes)

Default: 1000 (1 MB)

Note: While there is a max size, there is no maximum number for header logging files. To prevent running out of disk space, be sure to disable header logging once the necessary data has been obtained.

Update: Changes take effect after the next swiftfire boot.

FlushHeaderLogfileAfterEachWrite

Purpose: Forces a write-to-disk after each header that is received.

Type: Bool

Default: False

Note: In exceptional circumstances it may be useful to enforce as each header is received. Usually though the file system default will suffice.

Update: Changes take effect immediately.

Http1_0DomainName

Purpose: Map HTTP 1.0 request to a domain.

Type: String

Default: Empty

Note: HTTP 1.0 requests do not use the “Host” field. To be able to accept HTTP 1.0 requests this parameter should be set to the domain for the HTTP 1.0 requests.

Update: Changes take effect immediately.

SFDocumentCacheSize

Purpose: The size of the sf document cache in MBytes.

Type: Integer (MB)

Default: 100 MB

Note: Files which names contain the magic characters (“.sf.”) are scanned for functions. The scanning is done once and the result is stored in the cache. This parameter specifies the size of that cache.

Update: Changes take effect after the next swiftfire boot.

Server Telemetry

The following description uses the name as seen on the “Telemetry” page.

ServerVersion

This is the build-in version number of the Swiftfire server.

HttpServerStatus

Indicates if Swiftfire is accepting HTTP requests (‘Running’) or not.

HttpsServerStatus

Indicates if Swiftfire is accepting HTTPS requests (‘Running’) or not.

NofAcceptWaitsForConnectionObject

A client connection can only be “Accepted” if a connection object is available. Normally this should be the case and this telemetry item should remain steady. If however this parameter is incrementing regularly or fast, then it might be advantageous to increase the parameter ‘MaxNofAcceptedConnections’. Of course only if the system resources can handle it.

NofAcceptedHttpRequests

The total number of client connection requests that have been accepted since the server was booted.

NofHttp400Replies

The total number of bad requests detected at server level. Note that bad requests can be detected before a domain is asked to handle the request. The domain level can identified more HTTP 400 cases. If so, these are not included in this number.

This number if for information only as it pertains to errors in the HTTP request header.

NofHttp500Replies

The total number of errors created during a forwarding call. If this number increases the forwarding connections should be examined.

Domain Parameters

This uses the names found on the “Domains” page.

All updates to the domain settings are effective immediately after the update.

Note that the first item below refers to the name in the ‘Item’ column itself.

Name

This is the domain name as it will be seen in the HTTP host field. Usually this is the same name as is used in the URL. E.g. “apple.com” will use host name ‘apple.com’.

Do note that it can be difficult to test websites that are in some stage of development but for which the domain name has not been allocated yet. A browser that is pointed at the domain-name-to-be will try to resolve that name, and fail. Trying to point the browser at “localhost” will also fail because the host field of the HTTP request will then contain “localhost” instead of the domain name.

When creating a new domain/website it is usually best to name the site “localhost” until it can become operational. That way it is possible to test the site using a common browser like Safari. (Using the URL “localhost” in the browser URL field)

Include www

Set this flag to ‘true’ if the server should treat “mysite.com” the same as “www.mysite.com”.

If this flag is false then “www.mysite.com” and “mysite.com” will be seen as two different domains.

Root

The directory in which the “index.html” file for the domain can be found. Note that the index file may also end in htm as in: “index.htm”.

Make sure that “world” access to the root folder and all its subfolders/files is set to “read”. Otherwise Swiftfire will be unable to read the files.

Enabled

Set to ‘false’ to disable the domain (temporary?) and to ‘true’ to allow the domain to be used.

SF resources

The path to a folder where the server can access additional resources made available by the domain.

Currently this is used to support customised error pages.

Example: A file named “404_Not_Found.html” in this location will be returned if a 404 error occurs.

If no such file is present, a standard error response will be created.

The filenames can be derived from raw enum values in the file “HttpResponseCodes.swift” in SwiftfireCore. Replace the blanks by underscores and use the extension ‘html’.

Example: The code400_BadRequest raw value is “400 Bad Request”, the filename would be “400_Bad_Request.html”

Access Log

Enables an access log to be generated in “/Library/Application Support/Swiftfire/«domain-name»/logging”.

404 Log

Enables a log of all URL requests that resulted in a 404-Not-Found error in “/Library/Application Support/Swiftfire/«domain-name»/logging”

Session Log

Enables a log of all session in “/Library/Application Support/Swiftfire/«domain-name»/logging/sessions”

Session timeout

If a client does not access the server for this long, the session that was started for that client will be considered expired. Time is in Sec, zero means that no sessions are started.

Forward URL

if set, it will transfer the received HTTP request to the given domain:port and will return any data received from that Domain:Port. Swiftfire acts transparent in this case, everything that is received is sent out as it was received.

This can be useful if multiple server applications have to coexist on the same server. One server application then has to forward requests to the ports used by the other servers.

Domain Telemetry
Nof Requests

The total number of requests processed by this domain. Note that a single webpage may need multiple requests.

Nof Blacklisted Accesses

The total number of attempts by blacklisted domains

Nof200

The total number of HTTP Code 200 replies, i.e. the succesful return of a response message.

Nof400

The number of requests that had a failure in them, but which could be assigned to this domain. Bad requests that cannot be attributed to a domain are reported as server telemetry.

Note: The error is in the received request, so no corrective actions are possible.

Nof403

The number of attempts to access something to without the necessary access rights.

In the current version (0.9.15) of Swiftfire this occurs only for directories without an index.html file.

Nof404

The number of times a resource was requested which cannot be located.

Nof500

If this number increases, the logfile (if kept) should be examined. A cause should be determined and a fix should be implemented.

Nof501

The number of times the ‘not implemented’ response was returned.

Nof505

The number of times a HTTP version not supported response was returned.