@@ -49,8 +49,8 @@ type aliasHandler struct {
4949 restrictAccessDirs pathStringsList
5050
5151 globalHeaders [][2 ]string
52- headersUrls [] pathHeaders
53- headersDirs [] pathHeaders
52+ headersUrls pathHeadersList
53+ headersDirs pathHeadersList
5454
5555 globalUpload bool
5656 uploadUrls []string
@@ -189,6 +189,10 @@ func newAliasHandler(
189189 globalRestrictAccess = vhostCtx .restrictAccessDirs .mergePrefixMatched (globalRestrictAccess , util .HasFsPrefixDir , currentAlias .fs )
190190 globalRestrictAccess = util .InPlaceDedup (globalRestrictAccess )
191191
192+ globalHeaders := p .GlobalHeaders
193+ globalHeaders = vhostCtx .headersUrls .mergePrefixMatched (globalHeaders , util .HasUrlPrefixDir , currentAlias .url )
194+ globalHeaders = vhostCtx .headersDirs .mergePrefixMatched (globalHeaders , util .HasFsPrefixDir , currentAlias .fs )
195+
192196 h := & aliasHandler {
193197 alias : currentAlias ,
194198 emptyRoot : emptyRoot ,
@@ -214,9 +218,9 @@ func newAliasHandler(
214218 restrictAccessUrls : vhostCtx .restrictAccessUrls .filterSuccessor (util .HasUrlPrefixDir , currentAlias .url ),
215219 restrictAccessDirs : vhostCtx .restrictAccessDirs .filterSuccessor (util .HasFsPrefixDir , currentAlias .fs ),
216220
217- globalHeaders : p . GlobalHeaders ,
218- headersUrls : vhostCtx .headersUrls ,
219- headersDirs : vhostCtx .headersDirs ,
221+ globalHeaders : globalHeaders ,
222+ headersUrls : vhostCtx .headersUrls . filterSuccessor ( util . HasUrlPrefixDir , currentAlias . url ) ,
223+ headersDirs : vhostCtx .headersDirs . filterSuccessor ( util . HasFsPrefixDir , currentAlias . fs ) ,
220224
221225 globalUpload : p .GlobalUpload ,
222226 uploadUrls : p .UploadUrls ,
0 commit comments