Adding extra fields to request headers

how can i add extra fields to request headers ?

Pradeepta S. wrote:

how can i add extra fields to request headers ?

Please ask this in a Rails forum - this is Ruby here, not Rails.

If you don’t know the answer, it is absurd and ignorant to answer with
a non-answer.

Did you know you can do CGI on ruby? did you know that request headers
are a web server concept and language agnostic?

Besides, ruby on rails IS ruby in the end.

ANSWER:
It depends on the web server you’re using, but I will assume you’re
using apache, so you use something like this in httpd.conf or
apache.conf:

RequestHeader add X-Your-Variable-Name ‘The Value’

For example to use it to pass the logged on user name for a Windows
domain, something like this might work:

<VirtualHost *:82>
ServerName yourwinserver.com
ServerAlias www.yourwinserver.com

RewriteLog logs/myapp_rewrite_log
RewriteLogLevel 9

<Location />
    AuthName "Authenticate to MyApp"
    AuthType SSPI
    SSPIAuth On
    SSPIAuthoritative On
    SSPIOmitDomain On
    Require valid-user

    RewriteEngine On
    RewriteCond %{IS_SUBREQ} ^false$
    RewriteCond %{LA-U:REMOTE_USER} (.*)
    RewriteRule . - [E=RU:%1]
    RequestHeader add X-Remote-User %{RU}e

</Location>

ProxyPass / http://www.yourwebserver.com:3000/
ProxyPassReverse / http://www.yourwebserver.com:3000
ProxyPreserveHost on

Hope this helps. Have a good day!

On Tue, 05 Feb 2008 17:10:21 +1100, Clifford H.

Rha wrote:

If you don’t know the answer, it is absurd and ignorant to answer with
a non-answer.

No. The OP is almost certainly using Rails - or they would have
said what they are using - and your answer provides no help at all.

Did you know you can do CGI on ruby? did you know that request headers
are a web server concept and language agnostic?

Yes. And I could have given five answers, but in the final analysis,
it’s more helpful to direct the OP to where they can get help with
the framework they’re using.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs