Comments (4)
Yes, very happy with that. It's something that I've noticed when sharing the link, people access it from a multitude of URLs. 👍
from pct-shiny.
Yes, you should be using a canonical link, and https with www is best practice, redirecting all others to that, and retaining the local path.
ServerAlias pct.bike
# Force bare domain to be www instead
RewriteEngine on
RewriteCond %{HTTP_HOST} ^pct\.bike$ [NC]
RewriteRule (.*) https://www.pct.bike%{REQUEST_URI}
from pct-shiny.
Thanks but sadly we have haproxy so we can't use your nginx config. I don't know haproxy as well but I've added:
frontend http-in
bind ipv4@:80
bind ipv6@:80
# option httplog
option forwardfor
+
+ # Redirect http://(www.).pct.bike/a/b/c -> https://www.pct.bike/a/b/c
+ redirect prefix https://www.pct.bike code 301
+
acl letsencrypt-acl path_beg /.well-known/acme-challenge/
use_backend letsencrypt-backend if letsencrypt-acl
frontend http-ssl-in
bind ipv4@:443 ssl crt /etc/haproxy/certs/pct.bike.pem
bind ipv6@:443 ssl crt /etc/haproxy/certs/pct.bike.pem
+
+ # Detect the host name in the “ pct.bike ” header
+ acl nonww-acl hdr(host) -i pct.bike
+
+ # Redirect https://pct.bike/a/b/c -> https://www.pct.bike/a/b/c
+ http-request redirect prefix https://www.pct.bike code 301 if nonww-acl
+
and now they all seem to work. Note to self: haproxy is on all our production servers so the config needs to be changed in both places or it only intermittently works 🤦♂️.
from pct-shiny.
Great work @nikolai-b, confirmed as follows:
system("curl -s -L -D - http://pct.bike -o /dev/null -w '%{url_effective}'", intern = TRUE)
#> [1] "HTTP/1.1 301 Moved Permanently\r"
#> [2] "Content-length: 0\r"
#> [3] "Location: https://www.pct.bike/\r"
#> [4] "Connection: close\r"
#> [5] "\r"
#> [6] "HTTP/1.1 200 OK\r"
#> [7] "X-Powered-By: Shiny Server\r"
#> [8] "Accept-Ranges: bytes\r"
#> [9] "Cache-Control: public, max-age=0\r"
#> [10] "Last-Modified: Mon, 03 Feb 2020 22:04:17 GMT\r"
#> [11] "ETag: W/\"14e7-1700d153233\"\r"
#> [12] "Content-Type: text/html; charset=UTF-8\r"
#> [13] "Content-Length: 5351\r"
#> [14] "Vary: Accept-Encoding\r"
#> [15] "Date: Fri, 14 Feb 2020 09:17:47 GMT\r"
#> [16] "Set-Cookie: SERVERID=hex_3838; path=/\r"
#> [17] "Cache-control: private\r"
#> [18] "\r"
#> [19] "https://www.pct.bike/"
Created on 2020-02-14 by the reprex package (v0.3.0)
from pct-shiny.
Related Issues (20)
- RawGit has reached the end of its useful life HOT 9
- Link to codebooks more prominently HOT 1
- New links to key resources on website
- Mention widespread usage and influence of PCT on website
- Deploy new results
- School potential map
- Advanced training webinar HOT 2
- Move deployment to Github Actions HOT 1
- Accessibility statement on production HOT 17
- Test server is down HOT 5
- Checks are failing on master HOT 1
- Link of organizations uses a dead link on accessibility statement HOT 3
- Region stats tab on PCT.bike shows wrong data HOT 4
- Scope out options for next phase HOT 1
- Impact report 2020 HOT 2
- New case study on production HOT 1
- Server down HOT 9
- IMD tileserver changes HOT 9
- Test server not auto updating HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pct-shiny.