
Why the Usage of Instrumentation Within Monitoring Tools Should be Implemented in Your Next Web Project
Back-EndWhen designing a web application, a strategy that has often been used is to use a monitoring tool such as Grafana or Datadog. There...
It’s 2012. We know it’s the World Wide Web. We don’t need to be reminded of
that by prepending www.
to the URL of every site we visit. In fact, the use of www.
as the
de facto subdomain of The Web was an accident. And
what’s more, it was deprecated back in August of 2003.
I am over www.
and hereby pledege to do my best to stop using it on the
portions of the Internet that I build. To be successful, I need the Ruby on
Rails-powered apps I create to also drop the dubs. The powerful
router in Rails 3 (and newer) makes this trivial. Peep this:
Let’s talk about what’s going on there…
That outermost constraints
block is a Rails routing constraint
that only matches requests where the host starts with www.
. When that
constraint is met, we match ALL THE PATHS and any HTTP verb. Upon making the match, we tell the router
to redirect the request to a new URL.
The new URL is whatever URL the request came in on, sans the leading www.
.
Easy peasy!
For starters, I’ll hold it against you. But then I’ll immediately get over it
and we’ll go back to being friends.
In fact, as a token of my friendship, I’ll show you how to redirect non-www.
requests to a www.
-version.
This works much like the first example, but in reverse. An incoming request
lacking a leading www.
matches our constraint and gets redirected to the same
URL prefixed with a www.
.
Also easy, just more dub-dubs.
www.
or not?Do you have a preference or just an argument? Let’s hear it!
When designing a web application, a strategy that has often been used is to use a monitoring tool such as Grafana or Datadog. There...
There are several design patterns used these days in the .NET ecosystem. What are they? What are the benefits and drawbacks of each pattern?...
As a full-stack web developer, I attended SRECon to expand my thinking about the reliability and observability of the services I develop. Here are...