Hi Melan,

It's actually the Location header not the Host header.
https://github.com/apache/stratos/blob/master/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/mediators/LocationReWriter.java

Thanks


On Wed, Jun 18, 2014 at 2:37 PM, Imesh Gunaratne <im...@apache.org> wrote:

> Hi Melan,
>
> According to the current logic in LocationReWriter, even if the incoming
> Host header URL is relative the logic should not break. It will log the
> error and return without any problem. As a result the client will get the
> exact Host header returned by the member.
>
> However we could improve this logic not to trace an error if the incoming
> Host header URL is relative.
>
> Thanks
>
>
> On Wed, Jun 18, 2014 at 12:13 PM, Melan Nimesh <me...@apache.org> wrote:
>
>>
>>
>>
>> On Wed, Jun 18, 2014 at 8:16 AM, Isuru Haththotuwa <isu...@apache.org>
>> wrote:
>>
>>> Hi Melan,
>>>
>>> A good find. Agreed that Location header should be properly supported.
>>> Sorry if this is a dumb question, but could you please explain a bit more
>>> what is the issue that occurs in this specific scenario you tested?
>>>
>>
>> it's not a dumb question at all :)
>>
>> let's take running joomla for first time in a PHP cartridge as example
>>
>> Client request to LB
>>
>>
>> *GET / HTTP/1.1Host: joomla.example.org <http://joomla.example.org>*
>>
>> LB request to backend server
>>
>>
>>
>> *GET / HTTP/1.1Host: 10.100.1.96*
>> Backend server response:
>>
>>
>> *HTTP/1.1 302 Found Location: installation/index.php*
>>
>> LB should rewrite as below but it fails :
>>
>>
>> *HTTP/1.1 302 FoundLocation:
>> http://joomla.example.org/installation/index.php
>> <http://joomla.example.org/installation/index.php>*
>>
>> if backed server respond like as below, then it's working
>>
>>
>> *HTTP/1.1 302 FoundLocation: http://**10.100.1.96/
>> <http://10.100.1.96/>installation/index.php*
>>
>>
>> Thanks,
>> Melan
>>
>>
>>>
>>> On Wed, Jun 18, 2014 at 1:31 AM, Melan Nimesh <me...@apache.org> wrote:
>>>
>>>> Hi Devs,
>>>>
>>>> I noticed the $subject while subscribing to a PHP cartridge with a
>>>> joomla repository. LB fails to rewrite location header with relative URLs
>>>> with following error[1] and redirection not happens correctly. I think it's
>>>> a valid requirement to support to location header with relative URLs, since
>>>> it is valid according to the current revision of HTTP/1.1 and most browsers
>>>> support it (even though rfc2616[2] says location header's value is supposed
>>>> to be an absolute URI ), WDYT?
>>>>
>>>>
>>>> Thanks,
>>>> Melan
>>>>
>>>> [1]
>>>>
>>>> TID: [0] [LB] [2014-06-18 00:35:15,997]  INFO
>>>> {org.apache.synapse.core.axis2.TimeoutHandler} -  This engine will expire
>>>> all callbacks after : 86400 seconds, irrespective of the timeout action,
>>>> after the specified or optional timeout
>>>> TID: [0] [LB] [2014-06-18 00:35:23,474] ERROR
>>>> {org.apache.stratos.load.balancer.mediators.LocationReWriter} -  Could
>>>> re-write location header
>>>> java.net.MalformedURLException: no protocol: installation/index.php
>>>>     at java.net.URL.<init>(URL.java:585)
>>>>     at java.net.URL.<init>(URL.java:482)
>>>>     at java.net.URL.<init>(URL.java:431)
>>>>     at
>>>> org.apache.stratos.load.balancer.mediators.LocationReWriter.mediate(LocationReWriter.java:49)
>>>>     at
>>>> org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
>>>>     at
>>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
>>>>     at
>>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
>>>>     at
>>>> org.apache.synapse.mediators.filters.OutMediator.mediate(OutMediator.java:61)
>>>>     at
>>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
>>>>     at
>>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
>>>>     at
>>>> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
>>>>     at
>>>> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:228)
>>>>     at
>>>> org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:486)
>>>>     at
>>>> org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
>>>>     at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>>>     at
>>>> org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
>>>>     at
>>>> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
>>>>     at
>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>>>     at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>>>     at java.lang.Thread.run(Thread.java:744)
>>>>
>>>> [2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30
>>>>
>>>>
>>>> --
>>>> Melan Nimesh Jayasinghage
>>>>
>>>
>>>
>>
>>
>> --
>> Melan Nimesh Jayasinghage
>>
>
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PPMC Member, Apache Stratos
>



-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PPMC Member, Apache Stratos

Reply via email to