mod_migrate configuration - Orange-OpenSource/mod_dup GitHub Wiki

This page explains how to activate and configure mod_migrate.

Configuration independant from the location

Nothing.

Location dependent directives

The directives that follow are only accessible in an Apache location.

  • MigrateApplicationScope (ALL | URL | HEADER | BODY)

    • URL will apply the matching only on the query string
    • HEADER will apply the matching only on the HTTP Header
    • BODY will apply the matching only on the HTTP Body data
    • ALL will apply the matching on all of the above
  • MigrateEnv var regex value

    • Sets the environment variable var to value if the regex is matched
    • The scope applied is the one declared at the last declaration of MigrateApplicationScope
  • In the location should also figure the mod_rewrite directives, following the order:

    • RewriteEngine on
    • RewriteCond %{ENV:var} ^value$
    • RewriteRule ^.*$ http://url.to/rewrite/to [P]

    Indicate [P] to enable the proxy mode, otherwise do set this flag

A complete example

Using the env var var to decide to rewrite or not:

# Declare a location
<Location /migrate-test>

    # Scope (ALL, URL, HEADER, BODY): Specify where to apply the matching of the regex
    # In this example the matching will be searched through the URL (query string), the HEADER (HTTP Header) and the BODY (HTTP Data)
    MigrateApplicationScope ALL
    
    # Set the environment variable _var_ to _value_ if _regex_ is matched in the Scope defined before
    MigrateEnv var regex value
    # You can put other environment variable to set, or the same on with a different regex
    MigrateEnv var regex2 value

    MigrateApplicationScope URL
    MigrateEnv var3 regex3 value3

    # Enable
    RewriteEngine On
    RewriteCond %{ENV:var} ^value$
    # Don't forget to put the full path if it is on localhost with P enabled, e.g. http://localhost:port/...
    RewriteRule ^.*$ http://url.to/rewrite/to [P]

    Order deny,allow
    Allow from all
</Location>
⚠️ **GitHub.com Fallback** ⚠️