| OLD | NEW |
| 1 # XSS and clickjacking prevention headers | 1 # XSS and clickjacking prevention headers |
| 2 | 2 |
| 3 set $csp_frame ""; | 3 set $csp_frame ""; |
| 4 if ($uri ~ ^/(:?\w\w(_\w\w)?/)?(?:index|firefox|chrome|opera|android|internet-ex
plorer|safari|yandex-browser|maxthon)?$) | 4 if ($uri ~ ^/(:?\w\w(_\w\w)?/)?(?:index|firefox|chrome|opera|android|internet-ex
plorer|safari|yandex-browser|maxthon)?$) |
| 5 { | 5 { |
| 6 set $csp_frame "; frame-src www.youtube-nocookie.com;"; | 6 set $csp_frame "; frame-src www.youtube-nocookie.com;"; |
| 7 } | 7 } |
| 8 add_header Content-Security-Policy "default-src 'self'; img-src * data:; style-s
rc 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' $csp_
frame"; | 8 add_header Content-Security-Policy "default-src 'self'; img-src * data:; style-s
rc 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' $csp_
frame"; |
| 9 add_header X-Frame-Options "sameorigin"; | 9 add_header X-Frame-Options "sameorigin"; |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 rewrite ^/androidupdates.xml$ https://update.adblockplus.org/adblockplusandroid/
updates.xml permanent; | 87 rewrite ^/androidupdates.xml$ https://update.adblockplus.org/adblockplusandroid/
updates.xml permanent; |
| 88 rewrite ^/ieupdate.json$ https://update.adblockplus.org/adblockplusie/update.jso
n permanent; | 88 rewrite ^/ieupdate.json$ https://update.adblockplus.org/adblockplusie/update.jso
n permanent; |
| 89 | 89 |
| 90 rewrite ^/(\w\w(_\w\w)?/)?adblock-browser/?$ https://adblockbrowser.org/ permane
nt; | 90 rewrite ^/(\w\w(_\w\w)?/)?adblock-browser/?$ https://adblockbrowser.org/ permane
nt; |
| 91 | 91 |
| 92 location /redirect | 92 location /redirect |
| 93 { | 93 { |
| 94 set $adblock_browser_android_download "https://downloads.adblockplus.org/adblo
ckbrowser-1.1.0-arm.apk"; | 94 set $adblock_browser_android_download "https://downloads.adblockplus.org/adblo
ckbrowser-1.1.0-arm.apk"; |
| 95 set $adblock_browser_android_store "https://play.google.com/store/apps/details
?id=org.adblockplus.browser"; | 95 set $adblock_browser_android_store "https://play.google.com/store/apps/details
?id=org.adblockplus.browser"; |
| 96 | 96 |
| 97 set $lang "en"; |
| 98 |
| 99 if ($arg_lang ~ ^(\w+)) |
| 100 { |
| 101 set $lang $1; |
| 102 } |
| 103 |
| 97 # Google Play is not available in China, so we redirect them to the | 104 # Google Play is not available in China, so we redirect them to the |
| 98 # builds for download, see https://issues.adblockplus.org/ticket/3094 | 105 # builds for download, see https://issues.adblockplus.org/ticket/3094 |
| 99 if ($geoip_country_code = 'CN') | 106 if ($geoip_country_code = 'CN') |
| 100 { | 107 { |
| 101 set $adblock_browser_android_store $adblock_browser_android_download; | 108 set $adblock_browser_android_store $adblock_browser_android_download; |
| 102 } | 109 } |
| 103 | 110 |
| 104 if ($arg_link = "reporter_connect_issue") | 111 if ($arg_link = "reporter_connect_issue") |
| 105 { | 112 { |
| 106 rewrite ^ /forum/? redirect; | 113 rewrite ^ /forum/? redirect; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 132 if ($arg_link = "adblock_browser_android_beta_community") | 139 if ($arg_link = "adblock_browser_android_beta_community") |
| 133 { | 140 { |
| 134 rewrite ^ https://plus.google.com/communities/104936844759781288661? redirec
t; | 141 rewrite ^ https://plus.google.com/communities/104936844759781288661? redirec
t; |
| 135 } | 142 } |
| 136 if ($arg_link ~ "^adblock_browser_promotion_\d$") | 143 if ($arg_link ~ "^adblock_browser_promotion_\d$") |
| 137 { | 144 { |
| 138 rewrite ^ https://adblockplus.org/adblock-browser redirect; | 145 rewrite ^ https://adblockplus.org/adblock-browser redirect; |
| 139 } | 146 } |
| 140 if ($arg_link = "adblock_browser_android_support") | 147 if ($arg_link = "adblock_browser_android_support") |
| 141 { | 148 { |
| 142 rewrite ^ https://adblockbrowser.org/en/android-support/? redirect; | 149 rewrite ^ https://adblockbrowser.org/$lang/android-support/? redirect; |
| 150 } |
| 151 if ($arg_link = "adblock_browser_android_faq") |
| 152 { |
| 153 rewrite ^ https://adblockbrowser.org/$lang/android-support/faq? redirect; |
| 143 } | 154 } |
| 144 if ($arg_link = "adblock_browser_ios_support") | 155 if ($arg_link = "adblock_browser_ios_support") |
| 145 { | 156 { |
| 146 rewrite ^ https://adblockbrowser.org/en/ios-support/? redirect; | 157 rewrite ^ https://adblockbrowser.org/en/ios-support/? redirect; |
| 147 } | 158 } |
| 148 if ($arg_link = "adblock_browser_android_store") | 159 if ($arg_link = "adblock_browser_android_store") |
| 149 { | 160 { |
| 150 rewrite ^ $adblock_browser_android_store? redirect; | 161 rewrite ^ $adblock_browser_android_store? redirect; |
| 151 } | 162 } |
| 152 if ($arg_link = "adblock_browser_ios_store") | 163 if ($arg_link = "adblock_browser_ios_store") |
| (...skipping 10 matching lines...) Expand all Loading... |
| 163 } | 174 } |
| 164 if ($arg_link = "adblock_plus_safari_ios_store") | 175 if ($arg_link = "adblock_plus_safari_ios_store") |
| 165 { | 176 { |
| 166 rewrite ^ https://itunes.apple.com/app/adblock-plus-abp/id1028871868? redire
ct; | 177 rewrite ^ https://itunes.apple.com/app/adblock-plus-abp/id1028871868? redire
ct; |
| 167 } | 178 } |
| 168 if ($arg_link = "adblock_plus_sbrowser_store") | 179 if ($arg_link = "adblock_plus_sbrowser_store") |
| 169 { | 180 { |
| 170 rewrite ^ https://play.google.com/store/apps/details?id=org.adblockplus.adbl
ockplussbrowser? redirect; | 181 rewrite ^ https://play.google.com/store/apps/details?id=org.adblockplus.adbl
ockplussbrowser? redirect; |
| 171 } | 182 } |
| 172 | 183 |
| 173 set $lang "en"; | |
| 174 set $link ""; | 184 set $link ""; |
| 175 set $anchor ""; | 185 set $anchor ""; |
| 176 | 186 |
| 177 if ($arg_link ~ "^share-") | 187 if ($arg_link ~ "^share-") |
| 178 { | 188 { |
| 179 set $link "share"; | 189 set $link "share"; |
| 180 set $anchor "?a=minimal"; | 190 set $anchor "?a=minimal"; |
| 181 } | 191 } |
| 182 if ($arg_link = "uninstalled") | 192 if ($arg_link = "uninstalled") |
| 183 { | 193 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 197 } | 207 } |
| 198 if ($arg_link = "subscriptions") | 208 if ($arg_link = "subscriptions") |
| 199 { | 209 { |
| 200 set $link "subscriptions"; | 210 set $link "subscriptions"; |
| 201 } | 211 } |
| 202 if ($arg_link = "reporter_privacy") | 212 if ($arg_link = "reporter_privacy") |
| 203 { | 213 { |
| 204 set $link "privacy"; | 214 set $link "privacy"; |
| 205 set $anchor "#abp_issue_reporter"; | 215 set $anchor "#abp_issue_reporter"; |
| 206 } | 216 } |
| 217 if ($arg_link = "privacy") |
| 218 { |
| 219 set $link "privacy"; |
| 220 } |
| 207 if ($arg_link = "contribute") | 221 if ($arg_link = "contribute") |
| 208 { | 222 { |
| 209 set $link "contribute"; | 223 set $link "contribute"; |
| 210 } | 224 } |
| 211 if ($arg_link = "donate") | 225 if ($arg_link = "donate") |
| 212 { | 226 { |
| 213 set $link "donate"; | 227 set $link "donate"; |
| 214 } | 228 } |
| 215 if ($arg_link = "acceptable_ads") | 229 if ($arg_link = "acceptable_ads") |
| 216 { | 230 { |
| 217 set $link "acceptable-ads"; | 231 set $link "acceptable-ads"; |
| 218 } | 232 } |
| 219 if ($arg_link = "acceptable_ads_criteria") | 233 if ($arg_link = "acceptable_ads_criteria") |
| 220 { | 234 { |
| 221 set $link "acceptable-ads"; | 235 set $link "acceptable-ads"; |
| 222 set $anchor "#criteria"; | 236 set $anchor "#criteria"; |
| 223 } | 237 } |
| 224 if ($arg_link = "contributors") | 238 if ($arg_link = "contributors") |
| 225 { | 239 { |
| 226 set $link "contributors"; | 240 set $link "contributors"; |
| 227 } | 241 } |
| 228 | 242 |
| 229 if ($link = "") | 243 if ($link = "") |
| 230 { | 244 { |
| 231 return 404; | 245 return 404; |
| 232 } | 246 } |
| 233 | 247 |
| 234 if ($arg_lang ~ ^(\w+)) | |
| 235 { | |
| 236 set $lang $1; | |
| 237 } | |
| 238 if (!-f "$document_root/$lang/$link") | 248 if (!-f "$document_root/$lang/$link") |
| 239 { | 249 { |
| 240 set $lang "!!"; | 250 set $lang "!!"; |
| 241 } | 251 } |
| 242 set $langtest "$arg_lang $lang"; | 252 set $langtest "$arg_lang $lang"; |
| 243 if ($langtest ~ "^(\w+)-(\w+) !!") | 253 if ($langtest ~ "^(\w+)-(\w+) !!") |
| 244 { | 254 { |
| 245 set $lang "$1_$2"; | 255 set $lang "$1_$2"; |
| 246 } | 256 } |
| 247 if (!-f "$document_root/$lang/$link") | 257 if (!-f "$document_root/$lang/$link") |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 location /403.html | 321 location /403.html |
| 312 { | 322 { |
| 313 try_files $uri @proxied; | 323 try_files $uri @proxied; |
| 314 } | 324 } |
| 315 location @proxied | 325 location @proxied |
| 316 { | 326 { |
| 317 proxy_pass https://server16.adblockplus.org; | 327 proxy_pass https://server16.adblockplus.org; |
| 318 proxy_set_header Host adblockplus.org; | 328 proxy_set_header Host adblockplus.org; |
| 319 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | 329 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 320 } | 330 } |
| OLD | NEW |