← Back to team overview

openstack team mailing list archive

Re: HTTP headers are incorrectly treated case sensitive by jClouds causing OpenStack x-storage-url to fail

 

On Fri, 2013-06-28 at 16:39 +1000, Jamie Lennox wrote:
> On Thu, 2013-06-27 at 17:00 -0700, Ali, Saqib wrote:
> > We are using the jclouds library for connection to OpenStack Swift
> > (grizzly) cloud storage, and are running into the following
> > issue: https://issues.apache.org/jira/browse/JCLOUDS-155
> > 
> > We are using Apache web front for the swift proxy as defined
> > here:http://docs.openstack.org/developer/swift/apache_deployment_guide.html
> > 
> > Essentially the issue is that the Apache web front (using mod-wsgi)
> > returns a lower case header (x-storage-url), whereas jClouds is
> > expecting it to be X-Storage-URL (case-sensitive).
> > 
> > So the jClouds is being case-sensitive. When it shouldn't be. 
> > 
> > Is there anything we can do to work around this, while someone from
> > the jClouds community fixes this issue?
> > 
> > 
> > This is a rather urgent issue. Any help will be highly appreciated.
> 
> I have a middleware i use in testing which simply renames headers to do
> ProxyPass-ing env variables through apache. You'll need to modify it
> somewhat to get what you are looking for, but as a stop-gap you can use
> this: 

proxy_env.py

import logging                                                                  
                                                                                
LOG = logging.getLogger(__name__)                                               
                                                                                
                                                                                
class ProxyEnv(object):                                                         
    """Middleware that rewrites env headers                                     
                                                                                
    Particularly when using apache to forward requests you may have to          
    put environment variables into HTTP headers. This middleware is a simple       
    way of putting select variables back to hide the proxying from the app.        
    """                                                                         
    def __init__(self, app, global_conf, local_conf):                           
        self.app = app                                                          
        self.local_conf = local_conf                                            
        self.global_conf = global_conf                                          
                                                                                
    def __call__(self, env, start_response):                                    
        # this deliberately sets the new header to None if the old doesn't         
        # exist to prevent passing through unexpected headers.                  
        for old, new in self.local_conf.iteritems():                            
            env[new] = env.pop(old, None)                                       
                                                                                
        return self.app(env, start_response)                                    
                                                                                
                                                                                
def filter_factory(global_conf, **local_conf):                                  
    """Returns a WSGI filter app for use with paste.deploy."""                  
                                                                                
    def proxy_filter(app):                                                      
        return ProxyEnv(app, global_conf, local_conf)                           
    return proxy_filter 


configuration: 

[filter:proxyenv]                                                               
  paste.filter_factory = keystoneclient.middleware.proxy_env:filter_factory       
  HTTP_X_FORWARDED_REMOTE_USER = REMOTE_USER                                      
  HTTP_X_FORWARDED_AUTH_TYPE = AUTH_TYPE 


> 
> 
> > Thanks!
> > 
> > Saqib
> > 
> > 
> > _______________________________________________
> > Mailing list: https://launchpad.net/~openstack
> > Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~openstack
> > More help   : https://help.launchpad.net/ListHelp
> 
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp





References