Greetings.
There's been a long standing issue with sslonly sites and stg.
When you go to 'http://site.stg.whatever" you are redirected to 'https://site.whatever' which is anoying.
The current sslonly template has:
<% if sslonly -%> Redirect 301 / https://<%= name %>/ <% else -%>
So it does a redirect to the site 'name' which is always the production one.
I'd like to fix this, and changing the above Redirect to:
RewriteEngine On RewriteCond %{HTTP_HOST} ^(.+)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
seems to work. I tested it on stg with the qa site.
Can anyone see anything that would blow up if I made this change?
kevin
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Hello,
I agree to this change, but I would prefer you replace the 301 with a 302 redirect in case we change anything later on as 301 is cached way too long for staging purposes. Also, I think you should edit the RewriteRule to say ^/(.*)$, as otherwise extra slashes will be added (as discussed on IRC).
Patrick
On Wed, 1 May 2013 19:07:23 +0200 Patrick Uiterwijk puiterwijk@gmail.com wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Hello,
I agree to this change, but I would prefer you replace the 301 with a 302 redirect in case we change anything later on as 301 is cached way too long for staging purposes.
Well, this would apply to everywhere... production as well.
I don't much care if we do 302 tho. Any other thoughts?
Also, I think you should edit the RewriteRule to say ^/(.*)$, as otherwise extra slashes will be added (as discussed on IRC).
Yeah, will do.
kevin
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
On Wed, May 01, 2013 at 02:43:57PM -0600, Kevin Fenzi wrote:
Well, this would apply to everywhere... production as well.
I see, but still 301 would be cached too long if we'd change it later on (301 might cache forever in a browser, after all it means "permanently moved").
I don't much care if we do 302 tho. Any other thoughts?
Yes, you might make the RewriteCond a bit easier by replacing it with RewriteCond %{HTTPS} off.
kevin
Patrick
On Wed, 1 May 2013 10:50:07 -0600 Kevin Fenzi kevin@scrye.com wrote:
Greetings.
There's been a long standing issue with sslonly sites and stg.
When you go to 'http://site.stg.whatever" you are redirected to 'https://site.whatever' which is anoying.
The current sslonly template has:
<% if sslonly -%> Redirect 301 / https://<%= name %>/ <% else -%>
So it does a redirect to the site 'name' which is always the production one.
I'd like to fix this, and changing the above Redirect to:
RewriteEngine On RewriteCond %{HTTP_HOST} ^(.+)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
seems to work. I tested it on stg with the qa site.
Can anyone see anything that would blow up if I made this change?
That looks fine.
-sv
infrastructure@lists.fedoraproject.org