Adobe-Consulting-Services / acs-aem-commons

http://adobe-consulting-services.github.io/acs-aem-commons/
Apache License 2.0
453 stars 600 forks source link

Oak Index Manager on publish servers (resourcePath not working) #903

Closed ejocharcole closed 7 years ago

ejocharcole commented 7 years ago

I have a problem with Index Manager on publish servers: using ACS 2.9.0 with AEM 6.0 (SP3). I don't think the problem is specific to Index Manager, but I'd appreciate some advice.

Index Manager works on any author instance I've tried, but not on any publish server.

as far as I can see the issue is with this line: ng-controller="MainCtrl" ng-init="app.resource = '${resourcePath}'; init();"

on an author server this would result in: "app.resource = '/etc/acs-commons/oak-index-manager/_jcr_content'"

but on a publish server ${resourcePath} causes our sling mappings to come into play, so: "http://(DNS)/etc/acs-commons/oak-index-manager/_jcr_content"

this doesn't work, because instead of going direct to AEM on port 4503, the request goes out to port 80.

by contrast if I change the Jsp to use: ng-init="app.resource = '${currentPage.path}/_jcr_content'

Can anyone advise as to what the recommended use on a publish server is? It doesn't seem right for example that one would need to add extra sling mappings, just for this tool. Or make Apache changes (i.e. to allow requests re-written to port 80, to work). an additional complication is that we have a load balanced setup, and the sling mappings are designed for that - they weren't intended for use accessing tools on specific machines, even if that were desirable.

I had a look at the ACS source code and I can see ${resourcePath} is used a lot, so presumably this wouldn't just be any issue with index manager.

I have tried using override patterns and 'special patterns' in Link Checker, to see if that solves the issue, but I'm not sure link checker is even coming into play - I think it's just the sling mappings

would appreciate any advice!

davidjgonzalez commented 7 years ago

@ejocharcole the reason for running trough rr.map is to support people running servlet contexts (rr.map automatically adds the servlet context on) .. The code could be updated to pre-pend the servlet context itself.. but this is a pattern we use alot of places unfortunately.

I can't recall, does AEM 6.0 SP3 have the AEM provided Oak Index manager? (don't recall if that was back-ported or not).

/cc @justinedelson not sure you have thoughts on a better middle ground for exposing paths for the SPAs

ejocharcole commented 7 years ago

thanks for the reply @davidjgonzalez - at least I know I've understood the problem correctly!

As far as I know 6.0 SP3 doesn't include index manager, my understanding was index manager is included as of 6.2.

My original assumption was, that Index Manager would be used in the same way as say, CRXDE or the sling console - a tool accessible on 4502/4503, and internal use only so no Apache involvement. But I suppose the problem is that index manager is a content package, so that comparison isn't quite right.

Was it the intent for this tool to be used on publish servers? One reason I would like to, is because on certain environments we disable CRXDE for security - so it'd be really useful for maintenance purposes to allow our teams to rebuild indexes without having to temporarily enable CRXDE.

thanks!

justinedelson commented 7 years ago

This looks like an Apache/Dispatcher configuration issue to me. These paths just need to be allowed through to the publish server.