diff --git a/Add-Routing-Via-Config-File.md b/Add-Routing-Via-Config-File.md new file mode 100644 index 0000000..882e85c --- /dev/null +++ b/Add-Routing-Via-Config-File.md @@ -0,0 +1,78 @@ +Other than editing routing in the web UI, you can also create a config file and let Zoraxy load it on startup. You can put your config file under ```conf/proxy/``` as JSON file with file extension ".config". For example, here is an example of `(ST).test.localhost.config` + +**This config structure is for Zoraxy v3 only** +```json +{ + "ProxyType": 1, + "RootOrMatchingDomain": "*.test.yourdomain.com", + "Domain": "192.168.1.100:8080", + "RequireTLS": false, + "BypassGlobalTLS": true, + "SkipCertValidations": true, + "VirtualDirectories": [ + { + "MatchingPath": "/example/", + "Domain": "example.com", + "RequireTLS": true, + "SkipCertValidations": false, + "Disabled": false + }, + { + "MatchingPath": "/teacat/", + "Domain": "sorae.co", + "RequireTLS": true, + "SkipCertValidations": false, + "Disabled": false + } + ], + "UserDefinedHeaders": [ + { + "Key": "X-Special-Header", + "Value": "foo=bar" + } + ], + "RequireBasicAuth": false, + "BasicAuthCredentials": [ + { + "Username": "USERNAME", + "PasswordHash": "PASSWORD_HASH_HERE" + } + ], + "BasicAuthExceptionRules": [ + { + "PathPrefix": "/public/api/" + } + ], + "DefaultSiteOption": 0, + "DefaultSiteValue": "", + "Disabled": false +} +``` + +Here is another example that is use for default site (previously named Proxy Root). The file must be named as `root.config` + +```json +{ + "ProxyType": 0, + "RootOrMatchingDomain": "/", + "Domain": "imuslab.com", + "RequireTLS": true, + "BypassGlobalTLS": false, + "SkipCertValidations": false, + "VirtualDirectories": null, + "RequireBasicAuth": false, + "BasicAuthCredentials": null, + "BasicAuthExceptionRules": null, + "DefaultSiteOption": 1, + "DefaultSiteValue": "imuslab.com", + "Disabled": false +} +``` +Here are some key items for the proxy config +- ProxyType: 0 = root and 1 = host. For root, name your config file root.config +- RootOrMatchingDomain: Matching rules or keywords, use `/` for default site router +- Domain: Proxy target / backend +- RequireTLS: Proxy target require TLS (https) connection +- BypassGlobalTLS: Allow this rules to be accessed via port 80 endpoint (if enabled) +- SkipCertValidations: Skip proxy target TLS error, for self sign certificate +