0

I want to proxy one URI of my domain to a specific backend server.

I have a public domain name external.lan and a private one lets say internal.lan.

I want http://external.lan/gogs be served by internal server.

Here is my apache configuration block:

ProxyPass "/gogs" "http://internal.lan/gogs"
ProxyPassReverse "/gogs" "http://internal.lan/gogs"

This returns in logs:

[proxy:debug] [pid 4025] proxy_util.c(2118): AH00924: worker http://backup.localnet.lan shared already initialized

I have also tried:

ProxyPass "/gogs/(.*)$" "http://internal.lan/$1"
ProxyPassReverse "/gogs" "http://internal.lan/gogs"

This returns 404 error in external server logs.

I have also tried with mod_rewrite:

RewriteEngine On
RewriteRule "^/gogs/(.*)$" "http://internal.lan/$1 [P]
RewriteRule "/gogs/" "http://internal.lan/   [P,L]

With no luck.

How it is possible with only one domain name to proxy some URIs to backend server?

EDIT: here is my configuration file:

ServerSignature Off

Alias /glpi/ /var/www/glpi/

#ProxyPass        "/gogs/(.*)$" "http://backup.localnet.lan:6000/$1"
#ProxyPass        "/gogs/"      "http://backup.localnet.lan:6000/"
#ProxyPassReverse "/gogs" "http://backup.localnet.lan:6000/gogs"

ProxyPass "/gogs/" "http://backup.localnet.lan/"
#ProxyPassReverse /gogs/ http://backup.localnet.lan:6000

<VirtualHost web.localnet.lan:80>

   ServerAdmin web@localnet.lan
   ServerName web.localnet.lan
   ServerAlias web

   DocumentRoot /var/www/glpi

   <Directory />
      Options None
      AllowOverride None
   </Directory>

   <Directory /var/www/glpi>
      Options None
      AllowOverride None
   </Directory>

   <Directory /var/www/glpi/files>
      Options None
      AllowOverride None
      Order allow,deny
      deny from all
   </Directory>

#   RewriteEngine On
#   RewriteRule /gogs/(.*) http://backup.localnet.lan/$1 [P,L]
#   RewriteRule /gogs/ http://backup.localnet.lan/ [P,L]
#   RewriteRule "/gogs/"       "http://backup.localnet.lan/   [P,L]
#   ProxyPassReverse "/gogs/" "http://backup.localnet.lan/"
#   #RewriteRule "^/gogs/(.+)" "http://backup.localnet.lan/" [R,L]

   LogLevel  debug rewrite:trace6
   CustomLog ${APACHE_LOG_DIR}/glpi-access.log combined
   ErrorLog  ${APACHE_LOG_DIR}/glpi-error.log

</VirtualHost>
philippe
  • 2,303
  • 4
  • 32
  • 53
  • 1
    Can you share a complete configuration the reproduces the problem? If e.g. I grab the official httpd Docker image and deploy it with the stock configuration modified by your ProxyPass directives, it seems to work just fine (see [here](https://gist.github.com/larsks/b7ad7c96d895a9718f82152f189ee310) for my reproducer). – larsks Oct 18 '22 at 23:02
  • Thanks for your comment and your help with this investigation. I have just edited my question to provide my config file. – philippe Oct 19 '22 at 21:42
  • OK, nevermind. I got from your comment that issue i was having was not related to apache configuration. These servers were running into VMs, and i have bridge issues on the admin network. – philippe Oct 19 '22 at 22:19

0 Answers0