Apache Lounge


About Forum Index Downloads Search Register Log in RSS X

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Problem with ProxyPass

Joined: 03 Mar 2023
Posts: 4
Location: PL

PostPosted: Thu 09 Mar '23 14:11    Post subject: Problem with ProxyPass Reply with quote

I have two location directives with poxypass.
 <LocationMatch "^/(generatedFiles|app|resources|node_modules|desktop|desktop-pl|desktop-en|build|main.js|app.js)/">
      ProxyPass !

<LocationMatch "^/(.+)$">
      ProxyPassMatch https://lab-plat-all-stack-win.web.lab/$1

After entering the first directive, the second directive is also processed
How do I make the second location directive not be processed after entering the first location directive?
Back to top

Joined: 16 Aug 2020
Posts: 316
Location: UK

PostPosted: Fri 10 Mar '23 19:19    Post subject: Reply with quote

If you check the Apache documentation on how sections are evaluated / merged (https://httpd.apache.org/docs/current/sections.html#merging), you'll see the behaviour you're observing is to be expected. Basically the sections are merged sequentially, so your attempt to block proxying for certain URL paths does not carry from the first to second <Location> section.

Can I suggest you try reversing the logic, to proxy the entire site and then block the proxy for the content you want to serve locally, e.g.

<Location "/">
   ProxyPass https://lab-plat-all-stack-win.web.lab/

<LocationMatch "(?i)^/(generatedFiles|app|resources|node_modules|desktop|desktop-pl|desktop-en|build|main.js|app.js)">
   ProxyPassMatch "!"
Back to top

Reply to topic   Topic: Problem with ProxyPass View previous topic :: View next topic
Post new topic   Forum Index -> Apache