Dropping some URLs soon

On the process of updating my website to GitHub Pages (which you can find [here]({{ site.baseurl }}/2016/10/30/how-this-works/)) I have faced a lot of issues while trying to use PHP and GitHub Pages at the same time and the solution was to drop some API URLs.

Currently, I try to server static files from my VPS (the place where the Nginx instance is running) and if no file is found the request is proxied to my GitHub page located at hugmanrique.github.io. If a 404 error is thrown from their servers, an URL rewrite removes the .php extension if there's one and the tries to serve that PHP file.

Here comes the real problem: As I'm serving static files at first, if I try to access a folder that exists in my VPS, it tries to find an index.html or an index.php file. If it doesn't exist it simply throws a 404 error without checking GitHub because directory listing is disabled. This can be seen at the root path and at [/playmanager/]({{ site.baseurl }}/playmanager/).

I have solved that issue by adding custom rules per each directory that I need, but I feel this isn't the way to go. Here's where my solution comes:

I will drop every PHP request that isn't issued to the /backend/ directory where all the PHP scripts will be stored. This also adds some benefits:

  • I don't need to proxy your private POST data to GitHub servers
  • Latency is reduced because you will only need to reach one server: [hugmanrique.me]({{ site.baseurl }}).
  • Separate directories for each thing

I have already started the process of generalizing all the APIs and PHP handlers into one class (form-handler.php) and PlayManager, donation and miscellaneous APIs are already benefitting from the new changes.

The PlayManager old API urls are now throwing 301 error codes and a redirect to the new endpoint. This files won't be available from 30/11/2016 and will throw a 404 error. This will affect you if you use version 1.0.4 and below from the date I wrote before. There's already a quick fix available for download at the link you received in your email (this link will also be replaced, but you will receive a newer one in the changelog file).

Update 1: The PlayManager update has already being rolled out (1.0.5). You can download it from the old link until 30/11/2016 but you will receive a new email with the updated URL in case you don't have enough time to update.

Update 2: All the old URLs have being dropped today (2/12/16). Your PHP requests will be only served by my server and your GitHub requests will be only sent to GitHub.

© Hugmanrique. Made with