docs: added frontmatter to Markdown pages

This commit is contained in:
Dorian Niemiec 2024-09-07 18:15:36 +02:00
parent e05b2ff6a9
commit 2a6fb6fb83
28 changed files with 108 additions and 4 deletions

View file

@ -1,4 +1,8 @@
### Non-proxy API
---
title: Non-proxy API (legacy)
---
### Non-proxy API (legacy)
This API is exposed both to mods and server-side JavaScript. This API also includes proxy requests, which don't use CONNECT method. It's possible to determine, if the request comes from the proxy, by checking if _req.url_ begins with "_http://_" or with "_https://_" (unlike non-proxy requests, for which _req.url_ begins with "_/_") like this:

View file

@ -1,4 +1,8 @@
### Proxy API
---
title: Proxy API (legacy)
---
### Proxy API (legacy)
<small>_Added in SVR.JS 3.4.21, 3.7.0_</small>{" "}

View file

@ -1,3 +1,7 @@
---
title: Proxy callback API (module.exports.proxy)
---
### Proxy callback API (`module.exports.proxy`)
<small>_Added in SVR.JS 4.0.0_</small>{" "}

View file

@ -1,3 +1,7 @@
---
title: SVR.JS API (.tar.gz mods and server-side JavaScript)
---
## SVR.JS API (_.tar.gz_ mods and server-side JavaScript)
SVR.JS has its API for both _.tar.gz_ mods and server-side JavaScript that expands its functionality. SVR.JS API extends vanilla Node.JS HTTP API.

View file

@ -1,3 +1,7 @@
---
title: SVR.JS API (.js mods)
---
## SVR.JS API (_.js_ mods)
SVR.JS has its API for _.js_ mods that expands its functionality. SVR.JS API extends vanilla Node.JS HTTP API.

View file

@ -1,3 +1,7 @@
---
title: CGI/SCGI/JSGI/PHP
---
### CGI/SCGI/JSGI/PHP
In order to use CGI with SVR.JS, you need to install RedBrick mod. For SCGI you need to install OrangeCircle, while for JSGI you need to install YellowSquare mod. [Download these mods.](https://svrjs.org/mods)

View file

@ -1,3 +1,7 @@
---
title: CLI options
---
### CLI options
- _-h_, _-?_, _/h_, _/?_ or _--help_ - displays help

View file

@ -1,3 +1,7 @@
---
title: Client-initiated secure renegotiation
---
### Client-initiated secure renegotiation
Client-initiated secure renegotiation may pose DoS risks. However, Node.JS (JS runtime on which SVR.JS is running on) has built-in protection against DoS attacks caused by client-initiated secure renegotiation. Such attacks can be detected by looking for _ERR_TLS_SESSION_ATTACK_ errors in server log.

View file

@ -1,5 +1,5 @@
---
title: config.json properties
title: Configuration
---
## Configuration

View file

@ -1,3 +1,7 @@
---
title: Custom error pages
---
### Custom error pages
You can configure SVR.JS to serve custom error pages by adding _.&lt;errorcode&gt;_ (SVR.JS 3.0.0 or newer) or _&lt;errorcode&gt;.html_ pages. For the 404 error, you can specify it by changing the _page404_ property in _config.json_. From SVR.JS 3.8.0 onwards, you can use _errorPages_ property in _config.json_ to specify path to each custom error page.

View file

@ -1,3 +1,7 @@
---
title: Environment variables
---
### Environment variables
#### SVR.JS 3.12.0 and newer

View file

@ -1,3 +1,7 @@
---
title: Forward proxy notes
---
### Forward proxy notes
In order to use SVR.JS as a forward proxy, you need to install forward-proxy-mod SVR.JS mod. [Download this mod.](https://svrjs.org/mods)

View file

@ -1,3 +1,7 @@
---
title: HTTP authentication
---
### HTTP authentication
You can add HTTP basic authentication by including a 401 code (with _scode_ property set to 401) entry in the _nonStandardCodes_ property of _config.json_. To enable HTTP basic authentication, you need to specify the URL you want to restrict in the _url_ or _regex_ property of the entry. Additionally, you can set the authentication realm in the _realm_ property. If the realm is not specified, the default realm is "_SVR.JS HTTP Basic Authorization_". The encoding used for authentication will always be UTF-8.

View file

@ -1,3 +1,7 @@
---
title: Page customization
---
### Page customization
You can easily customize the appearance of pages served by SVR.JS by adding custom head and foot sections. These sections can be linked to every _.html_ file served by SVR.JS.

View file

@ -1,3 +1,7 @@
---
title: Redirects
---
# Redirects
Setting up HTTP redirects is simple with SVR.JS. You can add a 301 or 302 code (with `scode` property set to 301 or 302) entry to the `nonStandardCodes` property in `config.json`. The entry should specify the source URL for the redirect in the `url` or regular expression string for the redirect in `regex` property (for example `"/\\/blog($|[#?\\/].*)/"`), and the destination URL in the `location` property (for regular expressions, you can use for example `"$1"` for contents of the first capturing group). Destination location can be relative to the current site (for example `/blogs`) or a full URL (for example `https://blog.example.com`).

View file

@ -1,3 +1,7 @@
---
title: Reverse proxy configuration
---
### Reverse proxy configuration
In order to use SVR.JS as a reverse proxy, you need to install reverse-proxy-mod SVR.JS mod. [Download this mod.](https://svrjs.org/mods)

View file

@ -1,3 +1,7 @@
---
title: User management
---
### User management
You can manage users for HTTP authentication in SVR.JS by using _svrpasswd.js_ tool (SVR.JS 3.0.0 or newer). Usage is `node svrpasswd.js [-h] [--help] [-?] [/h] [/?] [-x] [-a|--add|-d|--delete] <username>`. Command-line options:

View file

@ -1,3 +1,7 @@
---
title: Virtual hosts
---
### Virtual hosts
When you're not planning to use SVR.JS server-side JavaScript or SVR.JS mods implementing individual web applications and plan to use SVR.JS similarly to Apache, nginx or IIS (static-only, PHP, CGI or JSGI), you can use virtual host-like functionality (name-based; IP-based from SVR.JS 3.14.1 and newer) with SVR.JS 3.8.0 or newer.

View file

@ -1,3 +1,7 @@
---
title: Installation
---
### Installation
#### Using SVR.JS installer (installer packages made in April 5, 2024 and later; GNU/Linux only)

View file

@ -1,3 +1,7 @@
---
title: SVR.JS commands
---
### SVR.JS commands
SVR.JS comes with a console interface that provides several built-in commands for managing the server and interacting with it.

View file

@ -1,5 +1,5 @@
---
title: SVR.JS File System
title: SVR.JS files
---
### SVR.JS files

View file

@ -1,3 +1,7 @@
---
title: Updating SVR.JS
---
### Updating SVR.JS
#### Using SVR.JS updater (included in SVR.JS installer package; GNU/Linux only)

View file

@ -1,3 +1,7 @@
---
title: Mod installation
---
## Mods
Mods in SVR.JS are custom modules that can extend the server's functionality. Using mods, you can extend SVR.JS functionality to suit your specific requirements and customize the server's behavior to handle different types of requests.

View file

@ -1,3 +1,7 @@
---
title: Mod development
---
### Mod development (_.js_ mods)
This section provides a comprehensive guide on developing `.js` mods for SVR.JS. Mods allow you to extend the functionality of SVR.JS by writing custom JavaScript code.

View file

@ -1,3 +1,7 @@
---
title: Mod files
---
### Mod files (_.tar.gz_ mods)
1. _index.js_ - main script for mod

View file

@ -1,3 +1,7 @@
---
title: Mod loading order
---
### Mod loading order
#### Startup

View file

@ -1,3 +1,7 @@
---
title: Migration to SVR.JS
---
### Migration to SVR.JS
If you have previously built your web application using the Node.JS http library, Express framework, or Koa framework, you can easily migrate that code to SVR.JS server-side JavaScript.

View file

@ -1,3 +1,7 @@
---
title: Server-side JavaScript
---
## Server-side JavaScript
Another way to expand SVR.JS functionality is through server-side JavaScript located in _serverSideScript.js_ file inside SVR.JS web root (or locaten in SVR.JS installation directory if you're running SVR.JS 3.9.0 or newer, and you have set _useWebRootServerSideScript_ property to _false_). Server-side JavaScript allows you to create various web applications using JavaScript, Node.JS and SVR.JS API.