Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

exclude path from dispatchert with Set-handler default-handler or none

Avatar

Level 3

Hello,

we need to proxy some locations with mod_proxy proxypass directive,
I am struggling with the way to disable dispatcher for some paths:

 

in <Location > tags in apache is it possible to use SetHandler default-handler and then proxypass?
would this be needed after the generic <Directory / >  dispatcher set-handler?
does anyone have a working config to share?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

HI,

 

The Directory and Files specifications apply specifically to the file system. Typically, access to only a few directory trees is permitted. Access to certain files such as .htaccess is usually forbidden, For some sites, the Directory and File specifications are sufficient, and no Location specifications are required. These specifications are generally used to control which directories can be accessed.

 

The <Location> functionality is especially useful when combined with the SetHandler directive. For example, to enable status requests but allow them only from browsers at example.com, you might use:

<Location "/status">
  SetHandler server-status
  Require host example.com
</Location>

Note about / (slash)

The slash character has special meaning depending on where in a URL it appears. People may be used to its behavior in the filesystem where multiple adjacent slashes are frequently collapsed to a single slash (i.e., /home///foo is the same as /home/foo). In URL-space this is not necessarily true if directive MergeSlashes has been set to "OFF". The <LocationMatch> directive and the regex version of <Location> require you to explicitly specify multiple slashes if the slashes are not being merged.

For example, <LocationMatch "^/abc"> would match the request URL /abc but not the request URL //abc. The (non-regex) <Location> directive behaves similarly when used for proxy requests. But when (non-regex) <Location> is used for non-proxy requests it will implicitly match multiple slashes with a single slash. For example, if you specify <Location "/abc/def"> and the request is to /abc//def then it will match.

 

I hope this help.



Arun Patidar

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

HI,

 

The Directory and Files specifications apply specifically to the file system. Typically, access to only a few directory trees is permitted. Access to certain files such as .htaccess is usually forbidden, For some sites, the Directory and File specifications are sufficient, and no Location specifications are required. These specifications are generally used to control which directories can be accessed.

 

The <Location> functionality is especially useful when combined with the SetHandler directive. For example, to enable status requests but allow them only from browsers at example.com, you might use:

<Location "/status">
  SetHandler server-status
  Require host example.com
</Location>

Note about / (slash)

The slash character has special meaning depending on where in a URL it appears. People may be used to its behavior in the filesystem where multiple adjacent slashes are frequently collapsed to a single slash (i.e., /home///foo is the same as /home/foo). In URL-space this is not necessarily true if directive MergeSlashes has been set to "OFF". The <LocationMatch> directive and the regex version of <Location> require you to explicitly specify multiple slashes if the slashes are not being merged.

For example, <LocationMatch "^/abc"> would match the request URL /abc but not the request URL //abc. The (non-regex) <Location> directive behaves similarly when used for proxy requests. But when (non-regex) <Location> is used for non-proxy requests it will implicitly match multiple slashes with a single slash. For example, if you specify <Location "/abc/def"> and the request is to /abc//def then it will match.

 

I hope this help.



Arun Patidar

Avatar

Level 3

Hello,

I tried to remove from a location or a directory the dispatcher handler both in <Directory> and < Location>
both with server-handler none and default-handler with no luck,

anyone has a working example?