I would like to ask apache how to implement the second-level directory reverse proxy.

now vhosts.conf has the following configuration

<VirtualHost *:80>
    ServerName mall.xxx.com
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
        Header set Access-Control-Allow-Origin *
        Header set Access-Control-Allow-Headers accept,authorization,content-type
    </Proxy>
    ProxyPass / http://127.0.0.1:8888/
    ProxyPassReverse / http://127.0.0.1:8888/
</VirtualHost>

now I want to implement
access mall.xxx.com proxy to http://127.0.0.1:8888/
access mall.xxx.com/seller proxy to http://127.0.0.1:8889/
, is there a way to implement

Oct.10,2021

level 2 is not A = > B = > C? Have I got it wrong all the time?

ProxyPassMatch address to be proxied to


<VirtualHost *:80>
    ServerName mall.xxx.com
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
        Header set Access-Control-Allow-Origin *
        Header set Access-Control-Allow-Headers accept,authorization,content-type
    </Proxy>
    ProxyPass /seller http://127.0.0.1:8889/seller
    ProxyPass / http://127.0.0.1:8888/
    ProxyPassReverse /seller http://127.0.0.1:8889/seller
    ProxyPassReverse / http://127.0.0.1:8888/
</VirtualHost>

has been solved. Just add multiple ProxyPass different directories to different addresses.

here is a reminder for children's shoes that you can use in the future. If you want to forward the dev project through the domain name secondary directory [ root domain occupied ] to the public network for testing, remember to change the output.publicPath of webpack to the baseUrl of vue.config.js , like me, if it is vue cli 3.x .

module.exports = {
  baseUrl: '/seller',
  devServer: {
    port: 8889,
  },

otherwise the resource will not load

finally complain that only 3 JS interface security domain names of Wechat official account can be set up. Otherwise, there is no need to mount multiple projects under the same domain name

.
Menu