Houdini 20.0 hwebserver

hwebserver.redirect function

Generates a Response object representing a 301 Moved or 302 Found HTTP response.

redirect(request, path, permanent=False):hwebserver.Response

The client must set the Host: HTTP header on the request for this to work (browsers and other well-written clients will always do this, but if you're writing your own lightweight client for some reason, you should keep this in mind).


The Request object passed to the URL handler or API function.


The server path to redirect the client to.


If True, the server returns HTTP status 301 Moved Permanently. Otherwise it returns 302 Found.

See also



Starting and Stopping

Handling Web Requests and Returning Responses


  • WebSocket

    Base class for WebSocket support with the embedded server.

  • hwebserver.webSocket

    Decorator for registering WebSocket classes with Houdini’s web server.

API Calls

  • hwebserver.apiFunction

    Decorator for functions that can be called through an API endpoint on Houdini’s web server, returning JSON or binary responses.

  • hwebserver.APIError

    Raise this exception in apiFunction handlers to indicate an error.