Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

www.srihash.org doesn't redirect to HTTPS when srihash.org (no www) does #122

Closed
freddyb opened this issue Apr 15, 2016 · 14 comments
Closed

Comments

@freddyb
Copy link
Contributor

freddyb commented Apr 15, 2016

STR

Not sure how redirection is currently configured. Seems like this isn't in the repo.

@fmarier
Copy link
Contributor

fmarier commented Apr 26, 2016

Not sure how redirection is currently configured. Seems like this isn't in the repo.

I have no idea either. There's a lot of magic I don't understand in this Heroku setup.

@XhmikosR
Copy link
Collaborator

XhmikosR commented Jun 1, 2016

Can't we get rid of the www redirect altogether?

@fmarier
Copy link
Contributor

fmarier commented Jun 1, 2016

Can't we get rid of the www redirect altogether?

What do you mean by that?

www.srihash.org doesn't redirect to anything at the moment and that's the problem. It just serves the page regardless of the scheme.

We could (in theory, still requires digging into the Heroku config) stop serving anything on www.srihash.org but that's seems less than ideal from a usability point of view.

@XhmikosR
Copy link
Collaborator

XhmikosR commented Jun 2, 2016

It seems you want the opposite from what I had in mind, i.e. serve from www.

So can't you just get rid of all redirects in Heroku and we'll handle them via HAPI?

@fmarier
Copy link
Contributor

fmarier commented Jun 2, 2016

So can't you just get rid of all redirects in Heroku and we'll handle them via HAPI?

Not sure, I filed a bug for this though.

@XhmikosR
Copy link
Collaborator

XhmikosR commented Jun 2, 2016

On a side note, we set all the headers for all file types which is redundant to say the least. I'll try to make a PR tomorrow for that.

@XhmikosR
Copy link
Collaborator

The redirect chain currently is this:

C:\Users\XhmikosR\Desktop>curl -ILl srihash.org
HTTP/1.1 307 Temporary Redirect
Server: Apache
X-Backend-Server: generic1.webapp.phx1.mozilla.com
Cache-Control: max-age=600
Content-Type: text/html; charset=iso-8859-1
Date: Sun, 12 Nov 2017 22:29:00 GMT
Location: https://srihash.org/
Transfer-Encoding: chunked
Connection: Keep-Alive
X-Cache-Info: not cacheable; response code not cacheable

HTTP/2 301
server: Apache
x-backend-server: generic5.webapp.phx1.mozilla.com
cache-control: max-age=600
content-type: text/html; charset=iso-8859-1
strict-transport-security: max-age=15768000
date: Sun, 12 Nov 2017 22:29:01 GMT
location: https://www.srihash.org/
accept-ranges: bytes
x-cache-info: caching

HTTP/1.1 200 OK
Server: Cowboy
Connection: keep-alive
Content-Security-Policy: default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self' ; frame-src 'self'
Strict-Transport-Security: max-age=15768000
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Download-Options: noopen
X-Content-Type-Options: nosniff
Cache-Control: no-cache
Content-Type: text/html; charset=utf-8
Content-Length: 4016
Vary: accept-encoding
Date: Sun, 12 Nov 2017 22:29:04 GMT
Via: 1.1 vegur

Now, as you can see, the first redirect isn't a 301 one.

BTW this issue seems "fixed" but personally I'd still like to have a 301 redirect :)

@fmarier
Copy link
Contributor

fmarier commented Feb 26, 2018

Ideally, we'd change the http://srihash.org to https://srihash.org redirect from a 307 to a 301, but more importantly, http://www.srihash.org doesn't redirect to https://www.srihash.org at all.

@XhmikosR
Copy link
Collaborator

I believe it needs a certificate too that is why it doesn't redirect. Should be easy to set up though.

@XhmikosR
Copy link
Collaborator

XhmikosR commented Mar 6, 2018

@fmarier: can you add an environment variable in AWS so that we do the redirect only for production?

We could then use https://www.npmjs.com/package/hapi-require-https

Or Heroku, not sure what you are using.

@mozfreddyb
Copy link
Contributor

With the way we resolved #243, we only need to ensure we redirect from HTTP to HTTPS on the www.srihash.org domain. This needs to happen in hapi. Let's discuss in #184 instead of here.

@XhmikosR XhmikosR reopened this Nov 21, 2019
@XhmikosR
Copy link
Collaborator

This is still an issue, unfortunately. I couldn't make #184 or #283 work, so we need some help here.

@freddyb
Copy link
Contributor Author

freddyb commented Nov 21, 2019

Ugh. Reminder (mostly for myself):

  • srihash.org is my personal hosting, just redirecting to HTTPS + www on heroku
  • www.srihash.org is heroku, which is controlled by this repo

Heroku exposes protocol information to the dyno through a custom HTTP header.
Quoting their help page:

Under the hood, Heroku router (over)writes the X-Forwarded-Proto and the X-Forwarded-Port request headers. The app must check X-Forwarded-Proto and respond with a redirect response when it is not https but http.

@mozfreddyb
Copy link
Contributor

this should finally work

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants