Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
othes-redirector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
othes-redirector
Commits
4742c50d
Commit
4742c50d
authored
3 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
the real redirector
parent
d144cfad
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
nginx-config/othes
+13
-51
13 additions, 51 deletions
nginx-config/othes
with
13 additions
and
51 deletions
nginx-config/othes
+
13
−
51
View file @
4742c50d
# Default server configuration
# othes.univie.ac.at uses redis database nr. 12 to redirect to utheses-prod
#
# server {
# listen 80;
# server_name netbox02.univie.ac.at;
# server_name gitlab02.phaidra.org;
# return 301 https://$server_name$request_uri;
# }
server {
server {
listen 80;
listen 80;
listen 443 ssl http2;
listen 443 ssl http2;
# server_name netbox02.univie.ac.at;
server_name othes.univie.ac.at;
server_name gitlab02.phaidra.org;
root /var/www/html/netbox02;
root /var/www/html/netbox02;
index index.html index.htm;
index index.html index.htm;
# location / {
access_log /var/log/nginx/othesredirect.log;
# try_files $uri $uri/ =404;
# }
# location /hello {
# content_by_lua '
# ngx.header["Content-Type"] = "text/html"
# ngx.say("hello world")
# ';
# }
location / {
location / {
content_by_lua_block {
content_by_lua_block {
...
@@ -40,20 +23,15 @@ local connect = function()
...
@@ -40,20 +23,15 @@ local connect = function()
return ngx.exit(ngx.ERROR)
return ngx.exit(ngx.ERROR)
end
end
red:select(10) -- we use db10
red:select(12) -- we use db12
-- red:set('URXN10', 'BLA10')
return red
return red
end
end
local meth= ngx.req.get_method()
local meth= ngx.req.get_method()
-- ngx.header["Content-Type"] = "text/html"
-- ngx.say("<h1>hello world</h1>")
-- ngx.say("<p>meth=[", meth, "]</p>");
if meth == "GET" or meth == "HEAD" then
if meth == "GET" or meth == "HEAD" then
local uri= ngx.var.uri
local uri= ngx.var.uri
-- ngx.say("<p>uri=[", uri, "]</p>");
local id, sep, rest
local id, sep, rest
for x1, x2, x3 in string.gmatch(uri, "/(%d+)(/?)(.*)") do
for x1, x2, x3 in string.gmatch(uri, "/(%d+)(/?)(.*)") do
id= x1
id= x1
...
@@ -61,49 +39,33 @@ end
...
@@ -61,49 +39,33 @@ end
rest= x3
rest= x3
break
break
end
end
-- ngx.say("<p>id=[", id, "] sep=[", sep, "] rest=[", rest, "]</p>");
if id and tonumber(id) > 0 then
if id and tonumber(id) > 0 then
-- ngx.say("<p>lookup redirect for id=[", id, "]</p>");
local red= connect()
local red= connect()
local newurl, err= red:get(id)
local newurl, err= red:get(id)
if type(newurl) == "string" then
if type(newurl) == "string" then
-- ngx.say("<p>newurl=[", newurl, "]</p>")
ngx.redirect(newurl, 301)
ngx.redirect(newurl)
else
else
ngx.header["Content-Type"] = "text/html"
ngx.header["Content-Type"] = "text/html"
ngx.say("<p>no redirection found (unkown id)</p>")
ngx.say("<p>no redirection found (unk
n
own id)</p>")
end
end
else
else
ngx.header["Content-Type"] = "text/html"
ngx.redirect("https://utheses.univie.ac.at/", 301)
ngx.say("<p>no redirection found (unknown url)</p>")
end
end
--[[
local args, err= ngx.req.get_uri_args()
for key, val in pairs(args) do
if type(val) == "table" then
ngx.say("<p>", key, ": ", table.concat(val, ", "), "</p>")
else
else
ngx.say("<p>", key, ": ", val, "</p>")
ngx.redirect("https://utheses.univie.ac.at/", 301)
end
end
--]]
else
ngx.header["Content-Type"] = "text/html"
ngx.say("<h1>sorry, can't help you</h1>")
end
end
}
}
}
}
ssl on;
ssl on;
# ssl_certificate /etc/ssl/certs/
fullchain_netbox
.univie.ac.at.crt;
# ssl_certificate /etc/ssl/certs/
othes
.univie.ac.at
_fullchain
.crt;
# ssl_certificate_key /etc/ssl/private/
netbox
.univie.ac.at.key;
# ssl_certificate_key /etc/ssl/private/
othes
.univie.ac.at.key;
ssl_certificate /etc/ssl/certs/fullchain_
gitlab.phaidra.org
.crt;
ssl_certificate /etc/ssl/certs/fullchain_
netbox.univie.ac.at
.crt;
ssl_certificate_key /etc/ssl/private/
gitlab.phaidra.org
.key;
ssl_certificate_key /etc/ssl/private/
netbox.univie.ac.at
.key;
ssl_session_timeout 5m;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1; # Dropping SSLv3, ref: POODLE
ssl_protocols TLSv1.2 TLSv1.1 TLSv1; # Dropping SSLv3, ref: POODLE
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment