[users@httpd] Question about Mod-proxy

2012-01-24 Thread Suneet Shah
Hello,

I have setup the mod proxy work with my application using the configuration
below.

When I enter a url such as http://host/myapp/ the proxy works correctly.
The target application comes up through the proxy

However, If I change url to:

http://host/myapp
(without the trailing slash), the proxy request fails.

I notice on the browser that it shows the URL of the target application  (
http://172.17.2.114:7070/myapp) instead the url through the proxy -
http://hostname/myapp.

Any thoughts on what I need to change in my configuration to make this work
without the trailing slash?

thanks
suneet


RewriteCond %{HTTP_COOKIE}
IAM_PARAM="userid=(.*)&tkn=(.*)&firstname=(.*)&secondname=(.*)&fullname=(.*)&role=(.*)&organization=(.*)&organizationoid=(.*)&permit=(.*)"
RewriteRule ^/ -
[E=var1:%1,E=var2:%2,E=var3:%3,E=var4:%4,E=var5:%5,E=var6:%6,E=var7:%7,E=var8:%8,E=var9:%9]

ProxyRequests Off

Order deny,allow
Allow from all



ProxyPass http://172.17.2.114:7070/myapp

RequestHeader append tkn %{var2}e
RequestHeader append userid %{var1}e
RequestHeader append Firstname %{var3}e
RequestHeader append Secondname %{var4}e





Re: [users@httpd] Mod-ReWrite

2011-09-24 Thread Suneet Shah
Sorry, please disregard my question.
I found my error.



On Sat, Sep 24, 2011 at 11:04 PM, Suneet Shah wrote:

> I tried to add another parameter to the query string and now the different
> parameters are getting merged together
> I am not sure if my error is in the RewriteCond or in the ReWriteRule. Any
> ideas?
>
> URL -> http://localhost/test_rpc/header.jsp?tkn=xyz&userid=mylogin
> HEADERS PASSED:
> tkn: xyz;var2:mylogin
> userid: (null)
>
> RewriteCond %{QUERY_STRING} tkn=(.*)&userid=(.*)
> RewriteRule ^/test_rpc - [E=var1:%1;var2:%2]
>
> RequestHeader append tkn %{var1}e
> RequestHeader append userid %{var2}e
>
> thanks for your help
>
>
>
> On Sat, Sep 24, 2011 at 10:44 PM, Suneet Shah wrote:
>
>> Mark,
>>
>> Many thanks for your help. This now works
>>
>> Suneet
>>
>>
>>
>> On Sat, Sep 24, 2011 at 10:33 PM, Mark Montague  wrote:
>>
>>> On September 24, 2011 22:23 , Suneet Shah 
>>> wrote:
>>>
>>>> I made the change that you described below. Now the tkn header is coming
>>>> in as null.   Have I made an error in assigning the tkn to var1?
>>>>
>>>> URL -> 
>>>> http://localhost/test_rpc/**header.jsp?tkn=abc<http://localhost/test_rpc/header.jsp?tkn=abc>
>>>> Header value -> tkn: (null)
>>>>
>>>> RewriteCond %{QUERY_STRING} tkn=(.*)
>>>> RewriteRule ^/test_rpc/$ [E=var1:%1]
>>>> RequestHeader append tkn %{var1}e
>>>>
>>>
>>> No, the problem is that the rewrite rule you have above tests for a path
>>> component that exactly matches /test_rpc/ with nothing before it and nothing
>>> after it.  The URL you are testing with has a path component of
>>> /test_rpc/header.jsp -- so this does not match, the rewrite rule does not
>>> get invoked, and the 'var1' environment variable does not get set.
>>>
>>> To get a rewrite rule that tests for the correct thing, see
>>> https://httpd.apache.org/docs/**2.2/rewrite/<https://httpd.apache.org/docs/2.2/rewrite/>in
>>>  particular the "Introduction to regular expressions and mod_rewrite"
>>> section.
>>>
>>> Also, you appear to be missing the second argument of the rewrite rule.
>>>  If you don't want to perform a substitution, then the substitution argument
>>> (the argument after the pattern argument and before the flags argument)
>>> needs to be a single dash ("-" without the quotes).
>>>
>>> --
>>>
>>>  Mark Montague
>>>  m...@catseye.org
>>>
>>>
>>
>


Re: [users@httpd] Mod-ReWrite

2011-09-24 Thread Suneet Shah
I tried to add another parameter to the query string and now the different
parameters are getting merged together
I am not sure if my error is in the RewriteCond or in the ReWriteRule. Any
ideas?

URL -> http://localhost/test_rpc/header.jsp?tkn=xyz&userid=mylogin
HEADERS PASSED:
tkn: xyz;var2:mylogin
userid: (null)

RewriteCond %{QUERY_STRING} tkn=(.*)&userid=(.*)
RewriteRule ^/test_rpc - [E=var1:%1;var2:%2]
RequestHeader append tkn %{var1}e
RequestHeader append userid %{var2}e

thanks for your help


On Sat, Sep 24, 2011 at 10:44 PM, Suneet Shah wrote:

> Mark,
>
> Many thanks for your help. This now works
>
> Suneet
>
>
>
> On Sat, Sep 24, 2011 at 10:33 PM, Mark Montague  wrote:
>
>> On September 24, 2011 22:23 , Suneet Shah 
>> wrote:
>>
>>> I made the change that you described below. Now the tkn header is coming
>>> in as null.   Have I made an error in assigning the tkn to var1?
>>>
>>> URL -> 
>>> http://localhost/test_rpc/**header.jsp?tkn=abc<http://localhost/test_rpc/header.jsp?tkn=abc>
>>> Header value -> tkn: (null)
>>>
>>> RewriteCond %{QUERY_STRING} tkn=(.*)
>>> RewriteRule ^/test_rpc/$ [E=var1:%1]
>>> RequestHeader append tkn %{var1}e
>>>
>>
>> No, the problem is that the rewrite rule you have above tests for a path
>> component that exactly matches /test_rpc/ with nothing before it and nothing
>> after it.  The URL you are testing with has a path component of
>> /test_rpc/header.jsp -- so this does not match, the rewrite rule does not
>> get invoked, and the 'var1' environment variable does not get set.
>>
>> To get a rewrite rule that tests for the correct thing, see
>> https://httpd.apache.org/docs/**2.2/rewrite/<https://httpd.apache.org/docs/2.2/rewrite/>in
>>  particular the "Introduction to regular expressions and mod_rewrite"
>> section.
>>
>> Also, you appear to be missing the second argument of the rewrite rule.
>>  If you don't want to perform a substitution, then the substitution argument
>> (the argument after the pattern argument and before the flags argument)
>> needs to be a single dash ("-" without the quotes).
>>
>> --
>>
>>  Mark Montague
>>  m...@catseye.org
>>
>>
>


Re: [users@httpd] Mod-ReWrite

2011-09-24 Thread Suneet Shah
Mark,

Many thanks for your help. This now works

Suneet


On Sat, Sep 24, 2011 at 10:33 PM, Mark Montague  wrote:

> On September 24, 2011 22:23 , Suneet Shah 
> wrote:
>
>> I made the change that you described below. Now the tkn header is coming
>> in as null.   Have I made an error in assigning the tkn to var1?
>>
>> URL -> 
>> http://localhost/test_rpc/**header.jsp?tkn=abc<http://localhost/test_rpc/header.jsp?tkn=abc>
>> Header value -> tkn: (null)
>>
>> RewriteCond %{QUERY_STRING} tkn=(.*)
>> RewriteRule ^/test_rpc/$ [E=var1:%1]
>> RequestHeader append tkn %{var1}e
>>
>
> No, the problem is that the rewrite rule you have above tests for a path
> component that exactly matches /test_rpc/ with nothing before it and nothing
> after it.  The URL you are testing with has a path component of
> /test_rpc/header.jsp -- so this does not match, the rewrite rule does not
> get invoked, and the 'var1' environment variable does not get set.
>
> To get a rewrite rule that tests for the correct thing, see
> https://httpd.apache.org/docs/**2.2/rewrite/<https://httpd.apache.org/docs/2.2/rewrite/>in
>  particular the "Introduction to regular expressions and mod_rewrite"
> section.
>
> Also, you appear to be missing the second argument of the rewrite rule.  If
> you don't want to perform a substitution, then the substitution argument
> (the argument after the pattern argument and before the flags argument)
> needs to be a single dash ("-" without the quotes).
>
> --
>
>  Mark Montague
>  m...@catseye.org
>
>


Re: [users@httpd] Mod-ReWrite

2011-09-24 Thread Suneet Shah
Hi,

thanks very much for your help with this. I am a bit unclear in how
information is assigned to variables and how they can be passed from one
directive to another.

I made the change that you described below. Now the tkn header is coming in
as null.   Have I made an error in assigning the tkn to var1?

URL -> http://localhost/test_rpc/header.jsp?tkn=abc
Header value -> tkn: (null)

RewriteCond %{QUERY_STRING} tkn=(.*)
RewriteRule ^/test_rpc/$ [E=var1:%1]
RequestHeader append tkn %{var1}e


Thanks for your help
Suneet



On Sat, Sep 24, 2011 at 4:25 PM, Mark Montague  wrote:

> On September 24, 2011 16:06 , Suneet Shah 
> wrote:
>
>> I have the following url:
>> http://localhost/test_rpc/**header.jsp?tkn=abc<http://localhost/test_rpc/header.jsp?tkn=abc>
>>
>> In my httpd.conf I added the following:
>>
>> RewriteEngine on
>> Options +FollowSymLinks
>>
>> RewriteCond %{QUERY_STRING} tkn=(.*)
>> RewriteRule ^/test_rpc/$ [E=var1:%1]
>> RequestHeader append tkn var1
>>
>> In my test, the Header "tkn" shows up with a value of "var1", instead of
>> "abc" which is on the query string.
>>
>
>
> The RequestHeader directive you currently have means "append the literal
> string 'var1' to the value of the header named 'tkn'"; this is why you are
> seeing the above result in your test.  The RequestHeader directive does not
> know that you want it to interpret 'var1' as the name of an environment
> variable, because you have not told it to do so.
>
> In order to append the value of the environment variable named 'var1' to
> the header named 'tkn', try
>
> RequestHeader append tkn %{var1}e
>
> For more information, see
>
> https://httpd.apache.org/docs/**2.2/mod/mod_headers.html#**requestheader<https://httpd.apache.org/docs/2.2/mod/mod_headers.html#requestheader>
> https://httpd.apache.org/docs/**2.2/mod/mod_headers.html#**header<https://httpd.apache.org/docs/2.2/mod/mod_headers.html#header>
>
> --
>  Mark Montague
>  m...@catseye.org
>
>


Re: [users@httpd] Mod-ReWrite

2011-09-24 Thread Suneet Shah
Hi,

i am still having some problem with getting this to work.  I am not getting
the value that is in the query string to appear in the header.
Any ideas on what I am doing wrong?

I have the following url:
http://localhost/test_rpc/header.jsp?tkn=abc

In my httpd.conf I added the following:

RewriteEngine on
Options +FollowSymLinks

RewriteCond %{QUERY_STRING} tkn=(.*)
RewriteRule ^/test_rpc/$ [E=var1:%1]
RequestHeader append tkn var1

In my test, the Header "tkn" shows up with a value of "var1", instead of
"abc" which is on the query string.

Thanks in advance for your help
suneet


On Wed, Sep 21, 2011 at 1:20 AM, Igor Cicimov  wrote:

> Hi mate,
>
> Try something like this for the example you gave
> http://host/myapp?userid=abc&role=myrole:
>
> RewriteEngine on
> Options +FollowSymLinks <http://host/myapp?userid=abc&role=myrole>
> RewriteCond QUERY_STRING userid=(.*)&role=(.*)
> RewriteRule ^/myapp$ [E=var1:%1,var2:%2]
>
> RequestHeader append userid var1
> RequestHeader append role var2
>
> This is untested and not sure about the correct syntax in the
> [E=var1:%1,var2:%2] flag, ie do you need coma or ; between the vars etc, but
> thats the general idea.
>
> Cheers,
> Igor
> On Wed, Sep 21, 2011 at 8:51 AM, Suneet Shah wrote:
>
>> Thanks Igor.
>>
>> Would you be able to point me to an example? I dont fully understand how I
>> can configure this to take a parameter of the query string and then set a
>> variable as a header.
>>
>> thanks for your help
>>
>>
>>
>> On Tue, Sep 20, 2011 at 6:29 PM, Igor Cicimov  wrote:
>>
>>> Use mod_rewrite to set variable and then set that var as header.
>>>   On Sep 21, 2011 7:32 AM, "Suneet Shah" 
>>> wrote:
>>> > Hello,
>>> >
>>> > I had a question about Mod-Proxy and Mod_headers
>>> >
>>> > 1) Is it possible to take a values that are on a query string and pass
>>> them
>>> > as headers? If so how?
>>> > For example, if I have:
>>> >
>>> > http://host/myap?userid=abc&role=myrole
>>> > I would like to take the values in the query string and pass them as
>>> headers
>>> > to the app that I am proying to
>>> >
>>> > 2) I would like to pass the above headers or query string parameters on
>>> > every request.
>>> > How can I do this? Is there a way to put these values in session have
>>> have
>>> > them passed as headers every time?
>>> >
>>> > If there is a better appraoch for the above, please let me know.
>>> >
>>> > thanks in advance for your help
>>> > suneet
>>>
>>
>>
>


Re: [users@httpd] Mod-Proxy and Mod-Headers

2011-09-21 Thread Suneet Shah
Hi Igor,

thanks for your help. I will try this out

suneet


On Wed, Sep 21, 2011 at 1:20 AM, Igor Cicimov  wrote:

> Hi mate,
>
> Try something like this for the example you gave
> http://host/myapp?userid=abc&role=myrole:
>
> RewriteEngine on
> Options +FollowSymLinks <http://host/myapp?userid=abc&role=myrole>
> RewriteCond QUERY_STRING userid=(.*)&role=(.*)
> RewriteRule ^/myapp$ [E=var1:%1,var2:%2]
>
> RequestHeader append userid var1
> RequestHeader append role var2
>
> This is untested and not sure about the correct syntax in the
> [E=var1:%1,var2:%2] flag, ie do you need coma or ; between the vars etc, but
> thats the general idea.
>
> Cheers,
> Igor
> On Wed, Sep 21, 2011 at 8:51 AM, Suneet Shah wrote:
>
>> Thanks Igor.
>>
>> Would you be able to point me to an example? I dont fully understand how I
>> can configure this to take a parameter of the query string and then set a
>> variable as a header.
>>
>> thanks for your help
>>
>>
>>
>> On Tue, Sep 20, 2011 at 6:29 PM, Igor Cicimov  wrote:
>>
>>> Use mod_rewrite to set variable and then set that var as header.
>>>   On Sep 21, 2011 7:32 AM, "Suneet Shah" 
>>> wrote:
>>> > Hello,
>>> >
>>> > I had a question about Mod-Proxy and Mod_headers
>>> >
>>> > 1) Is it possible to take a values that are on a query string and pass
>>> them
>>> > as headers? If so how?
>>> > For example, if I have:
>>> >
>>> > http://host/myap?userid=abc&role=myrole
>>> > I would like to take the values in the query string and pass them as
>>> headers
>>> > to the app that I am proying to
>>> >
>>> > 2) I would like to pass the above headers or query string parameters on
>>> > every request.
>>> > How can I do this? Is there a way to put these values in session have
>>> have
>>> > them passed as headers every time?
>>> >
>>> > If there is a better appraoch for the above, please let me know.
>>> >
>>> > thanks in advance for your help
>>> > suneet
>>>
>>
>>
>


Re: [users@httpd] Mod-Proxy and Mod-Headers

2011-09-20 Thread Suneet Shah
Thanks Igor.

Would you be able to point me to an example? I dont fully understand how I
can configure this to take a parameter of the query string and then set a
variable as a header.

thanks for your help


On Tue, Sep 20, 2011 at 6:29 PM, Igor Cicimov  wrote:

> Use mod_rewrite to set variable and then set that var as header.
>  On Sep 21, 2011 7:32 AM, "Suneet Shah"  wrote:
> > Hello,
> >
> > I had a question about Mod-Proxy and Mod_headers
> >
> > 1) Is it possible to take a values that are on a query string and pass
> them
> > as headers? If so how?
> > For example, if I have:
> >
> > http://host/myap?userid=abc&role=myrole
> > I would like to take the values in the query string and pass them as
> headers
> > to the app that I am proying to
> >
> > 2) I would like to pass the above headers or query string parameters on
> > every request.
> > How can I do this? Is there a way to put these values in session have
> have
> > them passed as headers every time?
> >
> > If there is a better appraoch for the above, please let me know.
> >
> > thanks in advance for your help
> > suneet
>


[users@httpd] Mod-Proxy and Mod-Headers

2011-09-20 Thread Suneet Shah
Hello,

I had a question about Mod-Proxy and Mod_headers

1) Is it possible to take a values that are on a query string and pass them
as headers? If so how?
For example, if I have:

http://host/myap?userid=abc&role=myrole
I would like to take the values in the query string and pass them as headers
to the app that I am proying to

2) I would like to pass the above headers or query string parameters on
every request.
How can I do this? Is there a way to put these values in session have have
them passed as headers every time?

If there is a better appraoch for the above, please let me know.

thanks in advance for your help
suneet


Re: [users@httpd] Mod-Proxy

2011-09-15 Thread Suneet Shah
Hi Joshua,

thanks for your help with this.
this is application was developed by a 3rd party.
Sounds like this will be fun

Regards,
Suneet


On Thu, Sep 15, 2011 at 1:40 PM, Joshua Stoutenburg wrote:

> On Thu, Sep 15, 2011 at 10:09 AM, Suneet Shah 
> wrote:
> > Hello,
> >
> > I am trying to setup a reverse proxy to one of our applications, but I am
> > finding that the page comes up, but all the urls that load the
> stylesheets
> > and javascript are all broken.
> >
> > I have pasted below my configuration. Any thoughts on what I am doing
> wrong
> > or overlooked?
> >
> > 
> >
> > ProxyPass http://172.17.2.113:2525/
> >
> > ProxyHTMLEnable On
> > ProxyHTMLURLMap  /  /app/
> > RequestHeaderunset  Accept-Encoding
> >
> > 
> >
> > Thanks for your help
> >
> >
>
> Coincidentally, I've been researching reverse proxy and found this:
> http://www.apachetutor.org/admin/reverseproxies#d8
>
> It looks like you have to do some extra work to write rules that match
> and rewrite all the urls throughout the html, css, javascript, etc.
>
> When I build a web application, I am very, very careful to write all
> urls so that the application can be moved from one server to another
> without breaking.  I use an approach I call "dynamic absolute" where
> the application dynamically detects its location in the file system
> and defines that as a constant for the rest of the application to use,
> then determines the proper http/https url, defining that as a constant
> as well.  Then throughout the application, I use the constants, rather
> than literally typed url.  The end result is absolute urls.
>
> If you didn't have any part in building the application, I apologize.
>
> I consider problems with urls to be a "code smell", specifically
> "Excessive use of literals" (http://en.wikipedia.org/wiki/Code_smell).
>
> Usually, where there is one code smell likely to be many more.  So
> watch out and good luck!
>
> -
> The official User-To-User support forum of the Apache HTTP Server Project.
> See http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
>   "   from the digest: users-digest-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>
>


[users@httpd] Mod-Proxy

2011-09-15 Thread Suneet Shah
Hello,

I am trying to setup a reverse proxy to one of our applications, but I am
finding that the page comes up, but all the urls that load the stylesheets
and javascript are all broken.

I have pasted below my configuration. Any thoughts on what I am doing wrong
or overlooked?



ProxyPass http://172.17.2.113:2525/

ProxyHTMLEnable On
ProxyHTMLURLMap  /  /app/
RequestHeaderunset  Accept-Encoding



Thanks for your help


Re: [users@httpd] Mod Proxy

2011-09-11 Thread Suneet Shah
Thanks Eric

On Sun, Sep 11, 2011 at 3:53 PM, Eric Covener  wrote:

> On Sun, Sep 11, 2011 at 3:39 PM, Suneet Shah 
> wrote:
> > Hello,
> >
> > I have setup a basic proxy configuration as shown below.  The application
> we
> > are integrating with, makes use of Java Applets that are launched through
> a
> > JNLP file.
> > I would like to know if this applet will be loaded through the proxy or
> if
> > the proxy skips this.
> >
> > In production we will have rules that force all requests to go through
> the
> > proxy and am trying to understand how this will works as I am bit new to
> > this.
>
> It should use the proxy. Confirming is as easy as reading the access
> log on the proxy server.
>
> -
> The official User-To-User support forum of the Apache HTTP Server Project.
> See http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
>   "   from the digest: users-digest-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>
>


[users@httpd] Mod Proxy

2011-09-11 Thread Suneet Shah
Hello,

I have setup a basic proxy configuration as shown below.  The application we
are integrating with, makes use of Java Applets that are launched through a
JNLP file.
I would like to know if this applet will be loaded through the proxy or if
the proxy skips this.

In production we will have rules that force all requests to go through the
proxy and am trying to understand how this will works as I am bit new to
this.

ProxyRequests Off

Order deny,allow
Allow from all



ProxyPass http://myhost:8080/viewer/
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1

RequestHeader append Userid "IDM_SRC"



Thanks in advance for your help


[users@httpd] Question About Mod-Headers

2011-09-11 Thread Suneet Shah
hello,

I am using Mod-Headers to pass some customer headers to one of our
applications.
I am passing some customer header using the directive below. However I am
noticing that the module converts the header value to be lower case.
The application that we are passing these to is checking the header name in
a case sensitive manner. Is there a way to control the case of these header
values as they are passed to the target application?

RequestHeader append Userid "my_header_value"


thanks for your help