Re: proxy subdirectory not being kept after redirection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A few comments first:

1) Try to avoid proxying inside a <Location> block, unless you have a good reason to. You have more control in the vhost context over the URI paths.
2) Stop using the 2.2 authz directives, those have been deprecated for over a decade

Now, your ProxyPassReverse is effectively:

ProxyPassReverse /host1/ http://192.168.4.12/

This means that if the backend issues a Location: header to something other than /host1/, you won't catch it. You need handle a more generic URI scheme.

On Tue, 4 Oct 2022 at 06:02, Duke Nguyen <duke.lists@xxxxxxx> wrote:

Hello everyone,

I have an issue with the proxy and subdirectory on httpd. What I wanted is whenever clients access http://mydomain.com/host1/, the server host A will proxy it to host B internally, with the URI http://mydomain.com/host1/ base unchanged. The httpd.conf on host A has the following:

<VirtualHost *:80>
ServerName mydomain.com
ProxyPreserveHost on
<Location “/host1/“>
ProxyPass "http://192.168.4.12/" retry=0
ProxyPassReverse "http://192.168.4.12/"
</Location>
</VirtualHost>

In the above httpd.conf, the internal IP 192.168.4.12 is the IP of the host B, and host1 is just a virtual directory that I’d like to name it. The host B is serving phpMyAdmin page, with the following httpd.conf

<VirtualHost *:80>
DocumentRoot /var/www/html/phpMyAdmin
<Directory /var/www/html/phpMyAdmin>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerName 192.168.4.12
ErrorLog logs/192.168.4.12_81_error_log
CustomLog logs/192.168.4.12_81_access_log common
</VirtualHost>

Accessing phpMyAdmin on host B internally in my network, with the URL http://192.168.4.12/ work just fine, ie http://192.168.4.12/index.php?abc will show http://192.168.4.12/index.php?abc. However, when I tried externally, it does not work as expected:

Please help!

Thanks

D.


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux