11 Tips and tricks
- URL Locations
With an application in mind, it is tempting to make all URL locations short and directly connected to the root (
). This is not a good idea. It is advised to have all locations in a server below a directory with an informative name. Consider to make the root location something that can be changed using a global setting./
- Page generating code can easily be reused. Using locations directly below the root however increases the likelihood of conflicts.
- Multiple servers can be placed behind the same public server as explained in section 3.14.7. Using a common and fairly unique root, redirection is much easier and less likely to lead to conflicts.
- Debugging
Debugging multi-threaded applications is possible using the graphical debugger. This implies requires that the xpce extension package must be installed. Spy-points may be placed using tspy/1. - URL/URI manipulation
Sometimes an http_handler/3 needs to inspect or normalize the URL. There are various utility predicates inlibrary(uri)
, such as uri_components/2, uri_data/4, uri_edit/3, uri_nomalized/2, etc.