Den tis 20 juli 2021 kl 00:22 skrev Mark Phippard <markp...@gmail.com>:

> Try the svn copy command and see if that works. It usually will not
> until/unless the HTTP "Destination" header is rewritten. You can do
> this on the Apache side if IIS cannot do it.
>

That was indeed a good catch. This page [1] provided valuable information
on how to do it on Apache. I wanted to do as much as possible on the IIS
side so I dived deep into the URL Rewrite module.

I finally found that I had to do two separate rewrite rules:
- Catching the requests having an HTTP Destination and switching from
https:// to http:// before forwarding the request. To make this work, I had
to add HTTP_DESTINATION as an acceptable server variable, see [2].
- Everything else (without setting any HTTP headers).

I hope it is not too much offtopic to paste the relevant part of web.config:

[[[
        <rewrite>
            <rules>
                <clear />
                <rule name="ProxyWithDestination" enabled="true"
stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll"
trackAllCaptures="false">
                        <add input="{HTTP_DESTINATION}" pattern="https://(.*)"
/>
                    </conditions>
                    <serverVariables>
                        <set name="HTTP_DESTINATION" value="http://{C:1}"; />
                    </serverVariables>
                    <action type="Rewrite" url="http://127.0.0.1:81/{R:1}";
/>
                </rule>
                <rule name="ProxyRest" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll"
trackAllCaptures="false" />
                    <action type="Rewrite" url="http://127.0.0.1:81/{R:1}";
logRewrittenUrl="true" />
                </rule>
            </rules>
        </rewrite>
]]]

Kind regards,
Daniel Sahlberg

[1] http://silmor.de/proxysvn.php
[2]
https://hammadk.wordpress.com/2013/04/29/add-the-server-variable-name-to-the-allowed-server-variable-list/

Reply via email to