config: redirect on server-side, so browsers won't be confused

This commit is contained in:
a1batross 2020-06-23 11:37:28 +02:00 committed by Gitea
parent 3bd8f9bfc4
commit f41d8eee6f
1 changed files with 13 additions and 3 deletions

View File

@ -57,7 +57,7 @@ server {
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;
# the nginx default is 1m, not enough for large media uploads
client_max_body_size 16m;
client_max_body_size 40m;
root /opt/pleroma/soapbox/static/;
@ -70,7 +70,17 @@ server {
}
# here goes long list of what we will use from real instance
location ~ ^/(api|.well-known|nodeinfo|proxy|media|emoji|oauth|favicon.ico) {
return 308 $scheme://example.com$request_uri;
location ~ ^/(api|.well-known|nodeinfo|proxy|media|emoji|oauth|favicon.*) {
proxy_pass $scheme://127.0.0.1$request_uri;
# proxy_redirect $scheme://example.com$request_uri $scheme://soapbox.example.com$request_uri;
proxy_set_header Host example.com;
proxy_set_header X-Real-IP $remote_addr;
# doesn't work with some browsers
# return 308 $scheme://example.com$request_uri;
}
access_log /var/log/nginx/access.soapbox.log;
error_log /var/log/nginx/error.soapbox.log;
}