Config 4: URL Handling

  1. General Properties
  2. Mime Types
  3. Authentication & Authorization
  4. URL Handling
    1. Protect Static Content
    2. Rerouting
    3. Caching
  5. Tasks


Although your URLs have a strict format, you can custom them using the URL routing feature in the configuration,  defined as Patterns in config.json. Not only rerouting, but it also provides a way to protect static contents for roles, and to cache dynamic contents onto disk.

"Patterns": [pattern, pattern, ...]

where object pattern is defined to be a map with the keys:

  • Case:  Static, Cache or Reroute. Default to Reroute.
  • Reg: a Regular Expression string. The first matched URL pattern will terminate the iteration.
  • Mats: the matched values will be assigned to the variables in this array.
  • Que: a query string to add extra variables by hand.
  • Expire:  in case of Cache, how many seconds the page should be expired.

If you use the built-in httpd server as in GO and Java, serving static content or rerouting URL is straightforward to do. In case of 3rd-party Apache server, you can use Fast CGI’s AAA handling feature. But that discussion goes a bit off-topics, which we’d like to make a separate document.


Comments are closed.