This week I ran into an issue with clean URLs (essentially an SEO friendly URL, so no question marks, equals signs, etc) in DKAN. I stumbled onto this while attempting to fix an issue with the DKAN datastore.
I could upload data (cvs, xls, etc) into DKAN and view the graphs and example data normally, but when I moved that data into the datastore then Recline would throw out an error. And it wasn’t a nice, informative error either. It was literally the word
error in a yellow box. Less than perfect, but at least it’s something.
Luckily, JS developers have a tendancy to throw errors into the browser console every once in a while, so I started digging there. Although there wasn’t a developer written error there, there was a 404 from Chrome complaining that I couldn’t find a particular JS file.
After jumping into Chrome’s developer console a bit deeper I found that DKAN was looking for a JS file via the API. Normally not an issue, except that Recline was expecting DKAN to use clean URLs, and I hadn’t set them up yet. Translation: Recline was looking for
/api/node and DKAN was serving
Now I had my problem clearly mapped out, all that was left was to fix it. I jumped into the Drupal Docs and found that you could turn Clean URLs on through the admin backend. However once I got there I found that it didn’t work. After a bit more searching around of Stack Overflow and the like, it turned out that I needed to edit my apache config files.
sudo a2enmod rewrite
sudo chmod 700 /etc/apache2/apache2.conf
sudo vim /etc/apache2/apache2.conf
- Found the
<Directory>bracket that I was concerned with an changed it to this:
Options Indexes FollowSymLinks AllowOverride All Require all granted
sudo chmod 600 /etc/apache2/apache2.conf
sudo service apache2 restart
- Navigate to
And there we have it!
Now all that was left was to refresh the browser, turn on Clean URLs, and then all the ReclineJS functions worked as expected!
A nice little Monday morning bug squashed by lunch!