On Mon, Aug 25, 2014 at 1:27 PM, Erik Weber <terbol...@gmail.com> wrote:

> On Mon, Aug 25, 2014 at 1:16 PM, Wido den Hollander <w...@widodh.nl>
> wrote:
>
>> On 08/25/2014 12:12 PM, Sebastien Goasguen wrote:
>>
>>> Folks,
>>>
>>> There is an outstanding issue with cloud-init compatibility.
>>> The VR serves the instance metadata through a web server but there is a
>>> trailing slash issue:
>>>
>>> https://issues.apache.org/jira/browse/CLOUDSTACK-7405
>>>
>>> Does anyone know where the settings for this web server are located in
>>> the cloudstack code ?
>>>
>>>
>> So I think that is done in systemvm/patches/debian/
>> config/opt/cloud/bin/vmdata.py
>>
>> It adds a RewriteRule to the .htaccess like:
>>
>> entry = "RewriteRule ^meta-data/(.+)$  ../" + folder +
>> "/%{REMOTE_ADDR}/$1 [L,NC,QSA]"
>>
>> I'm not a big mod_rewrite guru however.
>>
>>
> Adding a line with "RewriteRule ^meta-data$ ../" + folder
> +"/%{REMOTE_ADDR}/$1 [L,NC,QSA]"
> should suffice.
>
> small typo there...



>
> Tested on a VR with this config:
>
> RewriteRule ^meta-data/(.+)$  ../metadata/%{REMOTE_ADDR}/$1 [L,NC,QSA]
>
> RewriteRule ^meta-data/$  ../metadata/%{REMOTE_ADDR}/meta-data [L,NC,QSA]
>
> RewriteRule ^meta-data$  ../metadata/%{REMOTE_ADDR}/meta-data [L,NC,QSA]
>
>
>
A better solution is probably to make the last slash conditional, like this:
RewriteRule ^meta-data/?$  ../metadata/%{REMOTE_ADDR}/meta-data [L,NC,QSA]

tested:
[root@jenkins ~]# curl -I -s 10.30.81.1/latest/meta-data/ | grep HTTP

HTTP/1.1 200 OK

[root@jenkins ~]# curl -I -s 10.30.81.1/latest/meta-data | grep HTTP

HTTP/1.1 200 OK

Erik

Reply via email to