How to do 307 redirect with tuckey UrlRewriteFilter

264 views Asked by At

I have the following rule...

<rule>
    <condition type="scheme" operator="equal">^http$</condition>
    <from>/(.*)</from>
    <to type="temporary-redirect" last="true">https://something.com/$1</to>
</rule>

... And it works just fine (gives a 302 redirect) however i want to make it 307 redirect since that preserves parameters. I tried the following and have had no luck:...

<rule>
    <condition type="scheme" operator="equal">^http$</condition>
    <from>/(.*)</from>
    <set type="status">307</set>
    <to type="temporary-redirect" last="true">https://something.com/$1</to>
</rule>

Any idea how to do this?

1

There are 1 answers

0
user3113595 On

Figured it out!... You have to set the location header manually. Also null out the "to" node.

<rule>
    <condition type="scheme" operator="equal">^http$</condition>
    <from>/(.*)</from>
    <set type="status">307</set>
    <set type="response-header" name="Location">https://something.com/$1</set>
    <to last="true">null</to>
</rule>