0

Given the following virtualhost:

<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>

Can ahyone suggest why requests to local.dashboards/api are still being caught by the Location directive? I can confirm that the node server is catching the request to /api and returning a 404 page.

1

From the docs:

Aliasing occurs before <Directory> sections are checked, so only the destination of aliases are affected. (Note however <Location> sections are run through once before aliases are performed, so they will apply.)

A <Location /> will pretty much apply to everything.

How about something like <LocationMatch !^/api> instead?

  • It sounds like almost exactly what I need to do. Is there a way to specify multiple patterns to not match? I will have to add another Alias in order to make this all functional. – Noah Goodrich Jul 29 '14 at 3:46
  • @NoahGoodrich You can account for multiple paths in the same regex, <Location !^/(api|otherpath)> – Shane Madden Jul 29 '14 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.