NetSUS 4.2.1 and URL rewrites

jelockwood
Contributor

I have installed and I am running NetSUS 4.2.1 running on a Ubuntu 16.04 VM. It is downloading updates, I can edit settings and the catalogs and I have two catalogs defined.

I can access a catalog via a URL like http://sus.example.com/content/catalogs/index_released.sucatalog

The problem is that it is not redirecting to the relevant catalog for the version of operating system the client Mac is running. It should be for example redirecting to http://sus.example.com/content/catalogs/others/index-10.13-10.12-10.
11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1_released.sucatalog

I can see that the /etc/apache2/sites-enabled/000-default.conf contains RewriteRules which should do the same job as the .htaccess approach typically used with Reposado. (Which NetSUS is using.)

I even tried a .htaccess file as well and this is not working either.

apache2ctl -M shows mod_rewrite is loaded and in any case I did an a2enmod rewrite just in case.

Does anybody have any suggestions on how to fix this or narrow down the cause since my own attempts have so far failed.

(I have previously used genuine Reposado with .htaccess with no problems but this time wanted to use NetSUS.)

Update: Additional information
The repository is a mounted drive at /mnt/shared inside of which is srv/SUS/html, I have removed the standard /srv and created a symbolic link to /mnt/shared/srv via ln -s /mnt/shared/srv /srv this is working for NetSUS downloading the updates and as mentioned for my viewing http://sus.example.com/content/catalogs/index_released.sucatalog but not the redirection.

2 REPLIES 2

psliequ
Contributor III

I have noticed this too and just gotten in the habit of making OS specific configuration profiles to point each OS revision to their respective catalog.

jelockwood
Contributor

@psliequ Ok I think I have mine working now. Here is what I found.

Since I was having problems with the 000-default.conf that NetSUS installed which admittedly I had edited I reverted to effectively a blank one and gradually added bits to it. Via this I was able to get .htaccess to work and redirect as desired. During this process I discovered that the newer Ubuntu/Apache2 config has in /etc/apache2/apache2.conf changed some settings like FilesMatch disallowing .htaccess files, this may or may not be applicable. I found I needed to change the <Directory /var/www> in /etc/apache2/acpahe2.conf to AllowOverride All. Also the inclusion of Require all granted in some <Directory /> sections might be needed in my own site file.

Update: It looks like changing the FilesMatch in /etc/apache2/apache2.conf is not needed.

My test file did not include the built-in redirect rules.

Once I got the bare bones working with redirection I then started re-adding bits from the original 000-default.conf file still without the rewrite rules in it. I further discovered that the order of <Directory> directives could be important, that I needed to use <Directory /> for this requirement and that likely my prior attempt to be 'clever' and build-in a section to redirect http://sus.example.com" to https://sus.example.com/webadmin" might have been overriding the desired use of the .htaccess

I now have a different solution for dealing with webadmin I now have an

Alias /webadmin "/var/www/html/webadmin"
(The above alias is because my DocumentRoot is /srv/SUS/html/)
A <Directory /webadmin> section to include AllowOverride All
and in /var/www/html/webadmin I have created a .htaccess file to redirect from http://sus.example.com/webadmin to https://sus.example.com/webadmin

So I now have http://sus.example.com/webadmin working i.e. redirecting to https://sus.example.com/webadmin which loads successfully
I also have http://sus.example.com/index.sucatalog (or branches) redirecting correctly to operating system branches
I also have http://sus.example.com/content/catalogs/index.sucatalog (or branches) redirecting correctly to operating system branches

I do not use this for NetBoot or anything else so have not tested that.

Could someone either paste a copy or link to a copy of the original 000-default.conf? I have edited mine so much I would like to refer back. Surprisingly I could not find this file on GIT without doing a complete reinstall.