﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
1207	Distinguish between 301 and 302 redirects when proxy_redirect off	stackoverflow.com/users/4514467/hugmanrique		"I'm creating an app that proxies it's content to imgur. When an image doesn't exist, it returns a 302 redirection to the 404 page which then throws a 404 (not catched by proxy_intercept_errors on; because a 302 is considered the first error by nginx). When people are using a phone, imgur throws a 301 redirection to m.imgur.com/route. Both examples are cached by my error_page when I would only want to catch the 302 redirection as an error. Here's my config:

server {
	listen 443 ssl http2;
	listen [::]:443 ssl http2;

	server_name domain.tld;

	ssl_certificate /path/a.pem;
	ssl_certificate_key /path/b.pem;

	root /path/web/;
	index index.html;

	error_page 301 302 307 501 502 503 400 404 = /notFound.html;

	location ~ \.(png|gif|jpg|gifv) {
		proxy_pass https://i.imgur.com;
		proxy_redirect off;
	        proxy_intercept_errors on;
	}
}

A proxy_redirect_type option would be neat for these cases. Even if I remove the 301 from the error_page, nginx still catches it and serves a default error page."	defect	closed	minor	1.11	nginx-core	1.9.x	invalid	proxy,redirections		Linux hugmanrique 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux	"nginx version: nginx/1.10.0 (Ubuntu)
built with OpenSSL 1.0.2g  1 Mar 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wforat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/ngix --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log -error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-ath=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy--http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginxuwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-htp_stub_status_module --with-http_realip_module --with-http_auth_request_module -with-http_addition_module --with-http_dav_module --with-http_geoip_module --wih-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_moule --with-http_v2_module --with-http_sub_module --with-http_xslt_module --withstream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threas"
