From 8b6bc295a129d0f5f6e2163fb8d57347942d71d9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 9 Jan 2017 20:41:53 -0500 Subject: implement case-insensitive URLs --- TODO.org | 8 ++------ bin/lowercase.cgi | 8 ++++++++ nginx.conf.example | 6 ++++++ uwsgi.ini.example | 9 +++++++++ 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 bin/lowercase.cgi create mode 100644 uwsgi.ini.example diff --git a/TODO.org b/TODO.org index bad2593..1fe8e3a 100644 --- a/TODO.org +++ b/TODO.org @@ -1,6 +1,2 @@ -* functionality -- tag filtering -* style -- org tables -* wish -- case insenstive URLs +- documentation +- org tables (style) diff --git a/bin/lowercase.cgi b/bin/lowercase.cgi new file mode 100644 index 0000000..376ad54 --- /dev/null +++ b/bin/lowercase.cgi @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +uri="${REQUEST_SCHEME:-http}://${HTTP_HOST}${PATH_INFO}" +if test -n "$QUERY_STRING"; then + uri+="?$QUERY_STRING" +fi +printf '%s\r\n' \ + "Location: $uri" \ + '' diff --git a/nginx.conf.example b/nginx.conf.example index 734c7cd..403c66e 100644 --- a/nginx.conf.example +++ b/nginx.conf.example @@ -9,6 +9,12 @@ server { rewrite ^(.*[^/])$ $1/ permanent; } + location ~ [A-Z] { + uwsgi_pass unix:/run/uwsgi/www.sock; + uwsgi_modifier1 9; # Standard CGI request + include uwsgi_params; + } + location / { try_files /out$uri/index.html /out$uri /src$uri =404; } diff --git a/uwsgi.ini.example b/uwsgi.ini.example new file mode 100644 index 0000000..e392044 --- /dev/null +++ b/uwsgi.ini.example @@ -0,0 +1,9 @@ +[uwsgi] +master = true +processes = 1 + +uid = nobody +gid = http + +plugins = cgi +cgi = /srv/http/www.andrewdm.me/bin/lowercase.cgi -- cgit v1.2.3