Issue with proxy.pathsuffix

Not applicable

Hi everybody!

I want to have the proxy endpoint suffix like /session/open and real endpoint suffix /validateCredentials.

I create

        <Flow name="create">
            <Description/>
            <Condition>(proxy.pathsuffix MatchesPath "/session/open") and (request.verb = "POST")</Condition>
            <Request>
                <Step>
                    <Name>SaveMessageId</Name>
                </Step>
                <Step>
                    <Name>GetUsernameFromJSON</Name>
                </Step>
                <Step>
                    <Name>ReplaceSuffixForSessionOpen</Name>
                </Step>
            </Request>
            <Response>
                <Step>
                    <Name>OpenCache</Name>
                </Step>
            </Response>
        </Flow>

And create the step ReplaceSuffixForSessionOpen

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="ReplaceSuffixForSessionOpen">
    <DisplayName>ReplaceSuffixForSessionOpen</DisplayName>
    <Properties/>
    <AssignVariable>
        <Name>proxy.pathsuffix</Name>
        <Value>/validateCredentials</Value>
    </AssignVariable>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

I assume that then proxy suffix will be added to target endpoint URL, and be http://109.166.244.140:9763/webRS/services/user/validateCredentials instead of http://109.166.244.140:9763/webRS/services/user/session/open. What am I doing wrong?

1 3 1,000
3 REPLIES 3

@Oleksandr Skoryi ,

"proxy.pathsuffix" is read-only variable, you cannot write / update same. You can find same in variables reference documentation.

Regarding, changing target path, please find similar posts here.

But how can i deal with suffixes when i have loadbalancer on HTTPTargetConnection? I cann't pass fully changed URL in target.url variable. I Tried to use

    <Set>
        <Path>/webRS/services/user/validateCredentials</Path>
    </Set>

But it doesn't works properly

But in case when I have

    <AssignVariable>
        <Name>target.url</Name>
        <Value ref="">http://109.166.244.140:9763/webRS/services/user/validateCredentials</Value>
    </AssignVariable>
    <Set>
        <Path>/webRS/services/user/validateCredentials</Path>
    </Set>

it works perfect.

How can I set relative path without changing target.url?

Hi @Oleksandr Skoryi,

Here you can use Javascript to dynamically set the target.url following the conditions.

Note that the target.url can be used only in targetEndpoint.

Regarding your question on how to deal with suffixes with loadbalancer in HTTPTargetConnection, I am guessing you are trying to add pathSuffix dynamically to target while using target server.

Here again you can use javascript to set a variable(here pathSuffixVar)with the required target pathSuffix and then use the variable in HTTPTargetConnection as below:

<Path>{pathSuffixVar}</Path>

Let me know if this helps.