LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (http://www.linuxquestions.org/questions/general-10/)
-   -   Apache problem with proxy and reverseproxy (http://www.linuxquestions.org/questions/general-10/apache-problem-with-proxy-and-reverseproxy-895242/)

sameone 08-03-2011 03:10 AM

Apache problem with proxy and reverseproxy
 
Hello

I have problem to set the right url to show in reverseproxy

Example:

ProxyPass /red/ http://11.11.1.1/school/f?p=2
ProxyPassReverse /red/ http://11.11.1.1/school/f?p=2
RewriteRule ^/red$ /red/ [R]

Request url ... is not allowed.


The problem is in f?p=2 exactly the ?


How to set url or rule

bathory 08-03-2011 12:52 PM

Hi,
Quote:

The problem is in f?p=2 exactly the ?
Well, I don't get exactly what you're trying to do, but I don't think you can proxy a URI like /red to a query string in the backend server.
Maybe this should do what you want:
Code:

RewriteEngine on
RewriteRule  ^/red$ http://11.11.1.1/school/f?p=2 [P,QSA]


sameone 08-04-2011 01:06 AM

Your idea did not work.

What I am trynig to do.

When user from outside would write in URL some IP number, then will be redirected to Proxy server (https)

MY Proxy server
Linux Suse 11
192.1.0.1


And then when I would go from outside to 88.10.1.1, then I will be redirected to 192.1.0.1 and when I would add /red/, I will come to sharepoint


And this works(only with this one I have a problem, because is ? in url and apache convert this to %3F) - http://www.asciitable.com/

ProxyPass /red/ http://11.11.1.1/school/f?p=2
ProxyPassReverse /red/ http://11.11.1.1/school/f?p=2
RewriteRule ^/red$ /red/ [R]

bathory 08-04-2011 02:20 AM

First of all you should ask a moderator to move this thread to the Server forum, where it will get more attention.

As I've told you I don't think this can work. mod_rewrite has the [NE] option to not convert special characters to hex, but it doesn't apply here.
You may proxy /red/ to /school/, so when a client visits http://192.168.0.1/red/f?p=2 it will get the correct url from the backend

sameone 08-04-2011 04:54 AM

How can I wrote that ?

Is this OK.

ProxyPass /red/ http://11.11.1.1/red/f?p=2
ProxyPassReverse /school/ http://11.11.1.1/school/f?p=2
RewriteRule ^/red$ /red/ [R]

bathory 08-04-2011 05:26 AM

No, I was thinking something like that:
Code:

ProxyPass /red/ http://11.11.1.1/school/
ProxyPassReverse /school/ http://11.11.1.1/school/
RewriteRule ^/red$ /red/ [R]

So whatever is passed after the /red/ URI at the proxy will be passed to /school/ at the backend

sameone 08-04-2011 05:36 AM

It does not work

I also added AddDefaultCharset utf-8 and did not work


What else to do ?

bathory 08-04-2011 06:31 AM

Oups I've done a mistake
Quote:

ProxyPassReverse /school/ http://11.11.1.1/school/
It should be
Code:

ProxyPassReverse /red/ http://11.11.1.1/school/
Or maybe use the same for both, like:
Code:

ProxyPass /school/ http://11.11.1.1/school/
ProxyPassReverse /school/ http://11.11.1.1/school/
RewriteRule ^/red$ /school/ [R]

The hex character for the "?" is not a utf problem. It's the way apache represents special characters in urls
Other than that I don't know what else you can do. Maybe you should google to find if it's possible to reverse proxy your application and how

sameone 08-04-2011 07:02 AM

Did not work.

I google and I didn't find the right stuff.


IF you have some idea, please

bathory 08-04-2011 09:03 AM

You can check the logs on both apache and the backend server and see what happens.

sameone 08-05-2011 12:38 AM

192.168.1.1 - firewall


acces.log
192.168.1.1 - - [05/Aug/2011:07:19:12 +0200] "GET / HTTP/1.1" 403 1017
192.168.1.1 - - [05/Aug/2011:07:19:20 +0200] "GET /apex/ HTTP/1.1" 404 1237


error.log
[Fri Aug 05 07:19:12 2011] [error] [client 192.168.1.1] Directory index forbidden by Options directive: /srv/www/htdocs/

sslrequesst.log
05/Aug/2011:07:19:12 +0200] 192.168.1.1 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET / HTTP/1.1" 1017 "-" "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0"
[05/Aug/2011:07:19:20 +0200] 192.168.1.1 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /apex/ HTTP/1.1" 1237 "-" "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0"



I don't now, where to find backend log in linux suse server

bathory 08-05-2011 02:08 AM

The backend is the server you're trying to proxy (the one with the 11.11.1.1 IP)
What happens if you try to access apache on 192.168.0.1 from itself: http://192.1.0.1/school/?

sameone 08-05-2011 03:25 AM

Quote:

The backend is the server you're trying to proxy (the one with the 11.11.1.1 IP)
It's work.


Quote:

What happens if you try to access apache on 192.168.0.1 from itself: http://192.1.0.1/school/?
It's allso works.


This url(http://192.1.0.1/school/?) works from every computer, server,..

But not from proxy server

bathory 08-05-2011 03:43 AM

Quote:

The backend is the server you're trying to proxy (the one with the 11.11.1.1 IP)
It's work.
I know it works. Just ask to look at the logs to see what are the actual reverse proxy requests

Quote:

This url(http://192.1.0.1/school/?) works from every computer, server,..

But not from proxy server
Isn't the 192.1.0.1 the box running apache reverse proxy?
What other proxy you say?

sameone 08-05-2011 05:34 AM

My mistake

This url(http://192.1.0.1/school/? - is proxy server (192.1.0.1) and it gives the same error when I type this URL


Quote:

I know it works. Just ask to look at the logs to see what are the actual reverse proxy requests

What log I have to see. From my computer, when I go to http://11.11.1.1/red/f?p=2


thanks


All times are GMT -5. The time now is 01:38 PM.