I
I
Innokenty2019-11-06 15:44:27
Apache HTTP Server
Innokenty, 2019-11-06 15:44:27

Proxying rewrite_mod in apache?

Initially, the request goes to an external machine with nginx, where proxying is configured to the machine with apache, which should scatter requests to specific addresses.
It is necessary to proxy the request to a specific ip in the internal network, ip is contained in the URL itself.
Example, when entering the address shop.24.4.test.info, the request should go to the address 15.10.24.4/shop (the first 2 ip numbers are the same everywhere)

RewriteEngine on
  RewriteRule "~^.*shop(.*)\.test\.info.*$" http://15.10$1/shop

When trying to proxy to http://15.10$1/shop , the Apache proxy gives an error. Apparently the $1 variable cannot be taken out for a rewrite

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dodo512, 2019-11-06
@Kosyachella

http://domain/path
What part of the address is shop.24.4.test.info in?
The RewriteRule only checks the path, and the domain name must be looked up in %{HTTP_HOST}.
Or

RewriteCond %{HTTP_HOST} shop(\.\d+\.\d+)\.test\.info
RewriteRule ^ http://15.10%1/shop [P]

V
Viktor Taran, 2019-11-06
@shambler81

mod_proxy by default is not worth it, it needs to be delivered
. And the nginx proxy should do this, it makes sense to invent the wheel.
well, or on the edge of php proxy also notably works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question