Hello All,
I have one question related to apache2 rewrite rule.
In my network setup, I have one firewall and behind this firewall I have my private network (192.168.x.x network). I have one proxy server connected to my firewall. I redirected all http traffic from my private network to the proxy server on the firewall (in order to avoid the proxy configuration on each client (transparent proxying)). The proxy server then establishes a connection with the desired webserver and transfers the contents of the website to the client.
When I enable the proxy on the clients individually and start wireshark to capture the traffic,
I could see in wireshark under URI
(With the proxy enabled)
Request URI: http://www.mydomainexample.com/
and it works out (for the testing purpose, I have one webserver which simulates the domain name above in my virtual public network)
But when I disable the proxy on the clients and see what happens in wireshark
I could see
(without the proxy enabled)
Request URI: /
and it says on my client’s browser, no / folder was found at apache2 … etc…
Can please somebody explain why it does not work without proxy configuration on the client explicitly? I know that / is not known resource on the proxy server and therefore the proxy server itself says to the client that it does not have / folder. But can somebody please explain in a more detailed way what exactly happens?
I really appreciate the help.
And by having searched in google, I found the following script
(…)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 9
# if a REQUEST_URI starts with a / then do the rewrite
RewriteCond %{REQUEST_URI} ^/
# alter the GET /... to GET http://host/... so it is treated as
# a proxy request, and then forward it to mod_proxy immediately
RewriteRule (.*) http://%{HTTP_HOST}$1 [P]
</IfModule>
(…)
I used this script. It works now without any proxy configuration on the clients. I know that the proxy server rewrites the URI in some way so that it also proxies the request to the required webserver and transfers the content to the client back.
But why should we need this script? Why is the proxy server still not able to understand the http request from the client and gets the website when the firewall redirects all http traffic to the proxy?
I will appreciate any kind of help.
Thanks a million! rotfl!