URL redirect to an absolute URL (inc. query string)

I'd like to use the Webserver Protection module to handle a very specific redirection. Basically, we're in the process of preparing a multilingual site that will handle different domains internally, but until then I'd like to create a manual redirection for a specific domain to a specific URL (with query string).

In other words, I'd like to redirect mydomain.com to mydomain.pl/?lang=en

Alas, I can't seem to be able to do that; I wanted to use the Request Redirection section and a path of "/?lang=en", but then UTM informs me that this path contains invalid characters (it doesn't like the question mark).

So, can this be done, or do I need to spin up an IIS server internally solely to redirect requests?

  • Hi  

    It won't be possible to do that from GUI options. However, you can modify the /var/chroot-reverseproxy/usr/apache/conf/reverseproxy.conf and the line RedirectMatch to do this. First, configure the request redirect without in the path and then modify the file and edit the line. 

    Note: Please reach out to Sophos Support before trying this step if you have a licensed product. If you have a home license, feel free to try this as long as you are comfortable changing things back.

    Hope this helps.

  • In reply to Jaydeep:

    Thanks for the response. I'd try that, but we do have a Sophos licence, so as per your suggestion I'll contact them first.

  • In reply to Jaydeep:

    I got the green light from support to try this, however the actual problem this was meant to solve was... already resolved (the target server was reconfigured to handle the domain names, and in the short interim I spun up an IIS server with a redirect).

    Still, since I got the green light I went ahead and tested the proposed solution on some test DNS names, and sadly, it didn't work. It seemed as if my change in the configuration file wasn't being used at all (the Sophos admin panel didn't show the changed link and the redirection kept using the old link without the question mark). Perhaps some service needed to be restarted to re-load the file? Obviously any changes via the UI would overwrite the manual changes in the configuration file, so that's a dud.

    Still, thank you for the suggestion.

  • In reply to Mateusz Bender:

    Thanks for the update.

    It looks like we have reached a limitation on the redirect configuration part. It wouldn't accept ? in a valid redirect path. 

  • In reply to Mateusz Bender:

    Also, recent testing has shown that the reverseproxy.conf file is regenerated every time that you make a configuration change.   So it is not really a viable option to apply manual edits.