How to register a domain level app path/route?

HI All,

I’m wondering if it is possible to register a domain level app path/route in NC. For instance, if I want to register ‘https://ncdomain.com/Microsoft-Server-ActiveSync’.

From what I can tell, app routes in the route.php map to ‘/apps/app_name/route’. But is there a way to create a route without the ‘/apps/app_name’ or is this something that would need to be done on the server level?

Sebastian

I would say, this is too be done on server level. That has the reason that the apps have their dedicated namespace that prevents conflicts.

I suspect this is for a self written app this is not possible. I have not checked it, though. You could investigate the dav app as it has the /.well-knownendpoints, I guess. These are outside the normal routing scheme and might serve as a basis.

Please keep us posted about your findings.

Morning @christianlupus

From my interpretation of recommended server config I kind of figured that this was NOT possible. But I thought I would ask either way. I thought there might be a mechanism like Wordpress has, where you can create domain level route paths (https://ncdomain.com/path) without having to modify the Apache/Nginx/Etc config files.

When I get a minute, I’ll read through the servers/index.php, maybe I’ll find something in there.

Sebastian

Seems today is my lucky day, found this in the second file, I looked at. There is some promising code in the ‘/core/routes.php’ file.

'ocs' => [
	['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
]

That looks to me like a domain level path route. Now the question is will NC load the route, if I add it to the apps route.php. Will test it and let you know.

1 Like

I suspect this is an OCS route by the name but please prove me wrong!

Well so I was on the right track. This is the way to create a root level path.

'routes' => [
		[
			'name' => 'Test#Handle',
			'url' => '/eastest',
			'verb' => 'GET',
			'root' => '',
		],
]

But there is a hard coded filter at the end of the route creation mechanism, that only permits a few apps to create root level paths.

const rootUrlApps = [
		'cloud_federation_api',
		'core',
		'files_sharing',
		'files',
		'settings',
		'spreed',
	];

So its possible, just not permitted. That would mean the NC gatekeepers would need to add my app to the permitted list, for it to work.

Sebastian

1 Like