From 0936793b197ef6505599737cb744011150bc555a Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Fri, 15 Aug 2008 19:17:00 +0000 Subject: [PATCH] Adding FAQs svn: r11279 --- collects/web-server/scribblings/faq.scrbl | 56 +++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/collects/web-server/scribblings/faq.scrbl b/collects/web-server/scribblings/faq.scrbl index d7b21606bc..077a027776 100644 --- a/collects/web-server/scribblings/faq.scrbl +++ b/collects/web-server/scribblings/faq.scrbl @@ -3,9 +3,40 @@ @title{Troubleshooting} -@section{General} +@section{What special considerations are there for security with the Web Server?} -@subsection{IE ignores my CSS or behaves strange in other ways} +The biggest problem is that a naive usage of continuations will allow continuations to subvert +authentication mechanisms. Typically, all that is necessary to execute a continuation is its URL. +Thus, URLs must be as protected as the information in the continuation. + +Consider if you link to a public site from a private continuation URL: the @exec{Referrer} field in +the new HTTP request will contain the private URL. Furthermore, if your HTTP traffic is in the clear, +then these URLs can be easily poached. + +One solution to this is to use a special cookie as an authenticator. This way, if a URL escapes, it will +not be able to be used, unless the cookie is present. For advice about how to do this well, see +@link["http://cookies.lcs.mit.edu/pubs/webauth.html"]{Dos and Don'ts of Client Authentication on the Web} +from the MIT Cookie Eaters. + +Note: It may be considered a great feature that URLs can be shared this way, because delegation is +easily built into an application via URLs. + +@section{How do I use Apache with the PLT Web Server?} + +You may want to put Apache in front of your PLT Web Server application. +Apache can rewrite and proxy requests for a private (or public) PLT Web Server: + +@verbatim{ +RewriteRule ^(.*)$ http://localhost:8080/$1 [P] +} + +The first argument to @exec{RewriteRule} is a match pattern. The second is how to rewrite the URL. +The @exec{[P]} flag instructs Apache to proxy the request. If you do not include this, Apache will +return an HTTP Redirect response and the client should make a second request. + +See Apache's documentation for more details on @link["http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule"]{RewriteRule}. + +@section{IE ignores my CSS or behaves strange in other ways} @(require (for-label xml)) @@ -14,8 +45,27 @@ In quirks mode, IE does not parse your page as XML, in particular it will not re to format XML, which uses empty tag shorthand by default. You can change the default with the @scheme[empty-tag-shorthand] parameter: @scheme[(empty-tag-shorthand 'never)]. +@section{Can the server create a PID file?} -@subsection{How do I set up the server to use HTTPS?} +The server has no option for this, but you can add it very easily. There's two techniques. + +First, if you use a UNIX platform, in your shell startup script you can use +@verbatim{ +echo $$ > PID +exec run-web-server +} + +Using @exec{exec} will reuse the same process, and therefore, the PID file will be accurate. + +Second, if you want to make your own Scheme start-up script, you can write: +@(require (for-label mzlib/os)) +@schemeblock[ +(require mzlib/os) +(with-output-to-file _pid-file (lambda () (write (getpid)))) +(_start-server) +] + +@section{How do I set up the server to use HTTPS?} The essence of the solution to this problem is to use an SSL TCP implementation as provided by @schememodname[net/ssl-tcp-unit]. Many of the functions that start the Web Server are parameterized by a @scheme[tcp@] unit. If you pass an SSL unit, then the server will be serving HTTPS. However, to do this, you must write your own start up script. Here's a simple example: