Apache2 Proxy Pass 包括 URL 上的所有参数

Apache2 Proxy Pass Include all parameters on URL

是否可以在 Apache2 上进行代理传递,同时携带传递给后端服务器的参数?

示例:

www.frontserver.com -> www.frontserver.com (meaning that on the base directory it will not be proxied to any backend servers.)

如果它在 /_nuxt 目录下,它将被代理

www.frontserver.com/_nuxt/index.js -> backserver.com/_nuxt/index.js (dynamicaly)

您可以使用 P flag of mod_rewrite 完成此任务:

RewriteEngine On
RewriteRule "^_nuxt/(.*)" "%{ENV:protocol}://backserver.com/_nuxt/" [P]

你可以使用ProxyPassMatch匹配正则表达式

ProxyPassMatch "^_nuxt/(.*)" "http://backserver.com/_nuxt/"