This is a Rack-based redirector. It serves 301s and 410s from mappings created by Transition.
You can use the GOV.UK Docker environment to run the application and its tests with all the necessary dependencies. Follow the usage instructions to get started.
Use GOV.UK Docker to run any commands that follow.
Running the tests
bundle exec rake
In order to test the redirect feature of this app, you can use a special
bouncer-redirect.dev.gov.uk domain. We will create a mapping from this fake domain to GOV.UK.
Setup the Transition repo.
Run the following command in the Transition repo.
bundle exec rake import:all:orgs_sites_hosts
One of the created organisations will be “cabinet-office”, which we will use in the next step.
- Create a temporary site file in the Transition repo.
global: =301 https://www.gov.uk
- Run the following command in the Transition repo.
bundle exec rake 'import:org_sites_hosts[<path-to-file>]'
This will create the site in the shared Transition / Bouncer DB.
- Start the Bouncer app and go to bouncer-redirect.dev.gov.uk.
You should see that it redirects to GOV.UK, as specified in the site file.
Testing on staging environment
In contrast to other GOV.UK applications, Bouncer isn’t available at x.staging.publishing.service.gov.uk
This means that testing the application on our staging environment will require repointing the domains you wish to test by editing your computer’s host file to point them at Bouncer’s staging IP address. This should allow visiting the app in a web browser, for example. Alternatively, to make a request to our staging environment with curl:
curl -I -H"Host: www.attorneygeneral.gov.uk" http://0.0.0.0/aboutus/pages/civilcriminalpanels.aspx
Lists of domain names, old URLs and URLs to redirect to are stored in a
PostgreSQL database to which the application has read-only access.
Example application URLs
Here are some examples using a few of the many domain names which is served by