-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qt feature we use to download blog posts and blog images does not support HTTP redirect #41
Comments
For reference, this is the (current) nginx code I wrote to keep alive the updater after the removal of # Redirect http://www.unvanquished.net to https://unvanquished.net
# unless it may be fetched by updater v0.0.5 (json, images…)
# also rewrite json on the fly in this case
server {
listen 80;
listen [::]:80;
server_name www.unvanquished.net;
access_log /var/log/nginx/www.unvanquished.net.access.log;
error_log /var/log/nginx/www.unvanquished.net.error.log;
# letsencrypt
location /.well-known/acme-challenge {
root /path/to/unvanquished.net;
}
# images fetched by updater v0.0.5
location /wp-content/uploads/ {
access_log off;
proxy_pass https://localhost:443;
proxy_set_header Host unvanquished.net;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# latest articles json fetched by updater v0.0.5
# http://www.unvanquished.net/?json=get_recent_posts
location / {
access_log off;
# updater does not support redirect
# but we now redirect http to https
# and www.unvanquished.net
# to unvanquished.net
# by default, so we have to serve
# this content with a teapot 🍵
if ($arg_json = get_recent_posts) {
return 418;
}
rewrite ^(.*)$ https://unvanquished.net$1 permanent;
}
# return 200 OK code from teapot
error_page 418 =200 @teapot;
location @teapot {
# serve content with teapot
proxy_pass https://localhost:443;
proxy_set_header Host unvanquished.net;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# rewrite json on the fly
# to translate https to http
# and add missing www
sub_filter_types application/json;
sub_filter "https:\/\/unvanquished.net\/wp-content\/uploads\/" "http:\/\/www.unvanquished.net\/wp-content\/uploads\/";
sub_filter "https:\/\/www.unvanquished.net\/wp-content\/uploads\/" "http:\/\/www.unvanquished.net\/wp-content\/uploads\/";
sub_filter_once off;
}
} # Redirect http://dl.unvanquished.net to https://dl.unvanquished.net
# unless it may be fetched by updater v0.0.5 (json) or engine (pkg/)
server {
listen 80;
listen [::]:80;
server_name dl.unvanquished.net;
access_log /var/log/nginx/dl.unvanquished.net.access.log;
error_log /var/log/nginx/dl.unvanquished.net.error.log;
root /path/to/dl.unvanquished.net;
# letsencrypt
location /.well-known/acme-challenge {
}
# updater
location /versions.json {
}
# in-game download does not support https
# by adding the trailing / to the location we redirect /pkg to https but serve /pkg/* as http
# game never list the directory, we can redirect users to https
location /pkg/ {
try_files $uri $uri/ index.php;
autoindex on;
}
location / {
access_log off;
rewrite ^(.*)$ https://dl.unvanquished.net$1 permanent;
}
} |
Minor correction: updater uses aria2 rather than curl. |
Hmm, right, that probably does not change so much, does aria2 support HTTP redirect? |
server already rewrites content to fix urls and does more than just rewriting protocol, it also takes care of www prefix, see Unvanquished#41 (comment) for some information about how it was done server side
Aria2 is used for the torrent part, it's possible the news part use some Qt builtin. |
Aria2 supports redirect, that's Qt (blog post and images downloading) that does not support HTTP redirect. |
currently updater does not handle http redirect, it may be convenient to support them so we can update url in the future without using teapots.
The text was updated successfully, but these errors were encountered: