
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
rack-canonical-header
Advanced tools
Inserts a canonical url with a predefined host to prevent
search engines from crawling domains like herokuapp.com
git clone git@github.com:renuo/rack-canonical-header.git
cd rack-canonical-header
bin/setup
Add this line to your application's Gemfile:
gem 'rack-canonical-header'
And then execute bundle install
Set the CANONICAL_HOST
env variable to the desired host
(i.e. set it to the domain of your website like CANONICAL_HOST=example.com
)
The gem will inject a header of the format
Link: <http[s]://CANONICAL_HOST[/path]>; rel=canonical
as soon as the env is present.
The path and the scheme will be replaced
with what was requested on the original domain.
Note that the gem does no redirects. Therefore, your non-canonical urls will still work if you access them directly. However, search engines will not list them.
If you're using a framework which uses Rack (like Hanami)
you have to require and insert the middleware
Canonical::Middleware
manually into the rack stack.
For example:
require 'rack/auth/basic'
require 'rack-canonical-header'
module Web
class Application < Hanami::Application
configure do
middleware.use Canonical::Middleware
end
end
end
FAQs
Unknown package
We found that rack-canonical-header demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.