鉴于以下虚拟主机:
<VirtualHost *:80> DocumentRoot "/var/www/dashboards/public/dist" Servername local.dashboards ServerAlias local.dashboards Header add Access-Control-Allow-Origin: "*" Header add Access-Control-Allow-Methods: "POST, GET, OPTIONS, PUT, DELETE, HEAD" Header set Access-Control-Allow-Headers: "Origin, X-Requested-With, Content-Type, Accept, Authorization" Alias /api /var/www/dashboards/laravel/public <Directory "/var/www/dashboards/public/dist"> Options MultiViews FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> <Directory "/var/www/dashboards/laravel/public"> Options MultiViews FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> <Location /> ProxyPass http://localhost:3030/ ProxyPassReverse http://localhost:3030/ </Location> ErrorLog ${APACHE_LOG_DIR}/dashboards.error.log CustomLog ${APACHE_LOG_DIR}/dashboards.access.log combined </VirtualHost>
ahyone可以build议为什么local.dashboards / api的请求仍然被Location指令捕获? 我可以确认节点服务器正在捕获对/ api的请求并返回一个404页面。
从文档 :
别名发生在
<Directory>部分被选中之前,所以只有别名的目标被影响。 (注意,<Location>部分在执行别名之前运行一次,所以它们将被应用。)
一个<Location />几乎适用于一切。
那么像<LocationMatch !^/api>这样的东西呢?