Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-402

Redirection to relative URL

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Minor Minor
    • 1.2.0.Beta10
    • 1.2.0.Beta10
    • Core
    • None

      I need a rewrite rule like this :

      regex[pattern='/'] -> redirect['/homepage.html']
      

      But RFC-2616 says that the "Location" header should be an absolute URL.
      So I need a way to convert "/homepage.html" to an absolute URL.

      One way to do this is :

      redirect['%{SCHEME}://%{i,Host}/homepage.html']
      

      but it will not work for HTTP 1.0 requests (without a host header).

      A better way would be to use HttpServerExchange.getHostAndPort(), maybe through a new ExchangeAttribute type. For example :

      redirect['%{SCHEME}://%{HOST_AND_PORT}/homepage.html']
      

            sdouglas1@redhat.com Stuart Douglas
            gregory.lardiere Gregory Lardiere (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: