Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ jobs:
grep --fixed-strings '<p>It works!</p>' /tmp/out


curl -v --compressed localhost:8888/FooBar 2>&1 | tee /tmp/out

grep --fixed-strings 'HTTP/1.1 301 Moved Permanently' /tmp/out
grep --fixed-strings '< x-rewrite: 1' /tmp/out
grep --fixed-strings '< Location: http://localhost/foobar' /tmp/out


curl -v --compressed https://localhost:8889 2>&1 | tee /tmp/h2

grep --fixed-strings '< HTTP/2 200' /tmp/h2
Expand Down
12 changes: 8 additions & 4 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# this allows you to call directives such as "env" in your own conf files
# http://nginx.org/en/docs/ngx_core_module.html#env
#
# and load dynamic modules via load_module
# http://nginx.org/en/docs/ngx_core_module.html#load_module
include /etc/nginx/main.d/*.conf;


user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}
Expand Down Expand Up @@ -34,6 +41,3 @@ http {
include /etc/nginx/conf.d/*.conf;
}

# this allows you to call directives such as "env" in your own conf files
# http://nginx.org/en/docs/ngx_core_module.html#env
include /etc/nginx/main.d/*.conf;
2 changes: 2 additions & 0 deletions run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ docker run --rm \
-p 0.0.0.0:8889:443/tcp \
-p 0.0.0.0:8889:443/udp \
-v "$PWD/tests":/static:ro \
-v "$PWD/tests/modules.conf":/etc/nginx/main.d/modules.conf:ro \
-v "$PWD/tests/perl_rewrite.conf":/etc/nginx/conf.d/perl_rewrite.conf:ro \
-v "$PWD/tests/static.conf":/etc/nginx/conf.d/static.conf:ro \
-v "$PWD/tests/https.conf":/etc/nginx/conf.d/https.conf:ro \
-v "$PWD/tests/localhost.crt":/etc/nginx/ssl/localhost.crt:ro \
Expand Down
2 changes: 2 additions & 0 deletions tests/modules.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
load_module modules/ngx_http_geoip_module.so;
load_module modules/ngx_http_perl_module.so;
7 changes: 7 additions & 0 deletions tests/perl_rewrite.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://www.rewriteguide.com/nginx-enforce-lower-case-urls/
perl_set $uri_lowercase 'sub {
my $r = shift;
my $uri = $r->uri;
$uri = lc($uri);
return $uri;
}';
5 changes: 5 additions & 0 deletions tests/static.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ server {

expires 1d;
}

location ~ [A-Z] {
add_header x-rewrite 1;
rewrite ^(.*)$ $scheme://$host$uri_lowercase permanent;
}
}