Hey All,
I am trying to redirect (301) all HTTP request to TLS (HTTPS) and I keep
getting duplicate query strings added to the uri. e.g.:
curl -I “http://foo.bar.example.com/foobar.css?v=2”
HTTP/1.1 301 Moved Permanently
[clipped]
Location: http://foo.bar.example.com/foobar.css?v=2?v=2
Nginx config:
location / {
if ($scheme = http) {
rewrite ^ https://$http_host$request_uri permanent;
}
Any ideas?
Thanks in advance.
Regards,
Justin D. http://www.twitter.com/jdorfman
On Mon, May 05, 2014 at 12:14:48PM -0700, Justin D. wrote:
Hi there,
I am trying to redirect (301) all HTTP request to TLS (HTTPS) and I keep
getting duplicate query strings added to the uri. e.g.:
http://nginx.org/r/rewrite
Second last paragraph looks like it should fix it.
f
Francis D. [email protected]
Thanks Francis, worked perfectly.
Regards,
Justin D. http://www.twitter.com/jdorfman
Director of Developer Relations
MaxCDN http://twitter.com/MaxCDNDeveloper
Email / IM: [email protected]
Mobile: 818.485.1458
Twitter: @jdorfman http://www.twitter.com/jdorfman
@Richard Interesting. I shall give that a try.
Regards,
Justin D. http://www.twitter.com/jdorfman
Director of Developer Relations
MaxCDN http://twitter.com/MaxCDNDeveloper
Email / IM: [email protected]
Mobile: 818.485.1458
Twitter: @jdorfman http://www.twitter.com/jdorfman
On Mon, May 5, 2014 at 2:08 PM, Richard S.
Just a note, I think the preferred way to do this is with “return”. It’s
much simpler (no rewrite / PCRE overhead):
location / {
if ($scheme = http) {
return 301 https://$http_host$request_uri;
}