user1050755
user1050755

Reputation: 11691

WildFly expression variables

Is there any complete list of variables supported in WildFly web configuration expressions (eg rewrite filters)? Like %U, %h, %p...

<filters>
<rewrite name="http-to-https" redirect="true" target="https://myhostname:8443%U"/>
</filters>

<server name="default-server">
    <host name="default-host" alias="localhost">
        ...
        <filter-ref name="http-to-https" predicate="equals(%p,8080)"/>

Upvotes: 0

Views: 4123

Answers (2)

ehsavoie
ehsavoie

Reputation: 3517

Current WildFly (15) uses Undertow 2.0 so take a look at Undertow documentation on predicates: http://undertow.io/undertow-docs/undertow-docs-2.0.0/predicates-attributes-handlers.html

Upvotes: 2

Atul
Atul

Reputation: 1566

These are the attributes used by AccessLogHandler.java for log.

  • %a - Remote IP address
  • %A - Local IP address
  • %b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent
  • %B - Bytes sent, excluding HTTP headers
  • %h - Remote host name
  • %H - Request protocol
  • %l - Remote logical username from identd (always returns '-')
  • %m - Request method
  • %p - Local port
  • %q - Query string (excluding the '?' character)
  • %r - First line of the request
  • %s - HTTP status code of the response
  • %t - Date and time, in Common Log Format format
  • %u - Remote user that was authenticated
  • %U - Requested URL path
  • %v - Local server name
  • %D - Time taken to process the request, in millis
  • %T - Time taken to process the request, in seconds
  • %I - current Request thread name (can compare later with stacktraces)

    In addition, the caller can specify one of the following aliases for commonly utilized patterns:

    • common - %h %l %u %t "%r" %s %b
    • combined - %h %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}"

    There is also support to write information from the cookie, incoming header, or the session
    It is modeled after the apache syntax:

    • %{i,xxx} for incoming headers
    • %{o,xxx} for outgoing response headers
    • %{c,xxx} for a specific cookie
    • %{r,xxx} xxx is an attribute in the ServletRequest
    • %{s,xxx} xxx is an attribute in the HttpSession

    Upvotes: 1

  • Related Questions