Commit Graph

5 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 628b77dc82
NGINX config: add redirect rules for obsolete archive pages
This adds redirect rules to redirect URLs for archives that are no longer hosted
to the current documentation.

Some test scenarios below to verify:

Current docs
--------------------------------------------------------------------------------

- http://localhost:4000/engine/reference/commandline/create
    - redirects to http://localhost:4000/engine/reference/commandline/create/ (with trailing slash)
- http://localhost:4000/engine/reference/commandline/create/
- http://localhost:4000/engine/reference/commandline/create/index.html

Archived docs for current archives (e.g. v18.09):
--------------------------------------------------------------------------------

- http://localhost:4000/v18.09/engine/reference/commandline/create
  - ideally this should redirect to http://localhost:4000/v18.09/engine/reference/commandline/create/ (with trailing slash)
- http://localhost:4000/v18.09/engine/reference/commandline/create/
- http://localhost:4000/v18.09/engine/reference/commandline/create/index.html

Non-existing pages
--------------------------------------------------------------------------------

These should produce a 404 (not found)

- http://localhost:4000/no/such/page/
- http://localhost:4000/v18.09/no/such/page/
    - redirects to http://localhost:4000/no/such/page/

URLs for archived versions that are not, or no longer, published
--------------------------------------------------------------------------------
These are not found, because we don't (or no longer) publish these archive versions.
Because they start with `/vXX.XX/`, we redirect them to the same location in the
current docs. Note that the location redirected to may not (or no longer) exist,
and as such could result in another 301 redirect, or a ultimately a 404 ("not found").

Given that these should not re-appear, these redirects use a 301 (permanent). There
is one corner case; URLs for _future_ releases (e.g. `/v20.03/`) will _also_ produce
a 301, which could be cached by browsers / proxies, and effectively "block" the
URL for future use. I don't think this is very problematic, or at least not
something we should care about.

- http://localhost:4000/v17.99/engine/reference/commandline/run
    - redirects to http://localhost:4000/engine/reference/commandline/run/ in the current docs
- http://localhost:4000/v17.99/engine/reference/commandline/run/
    - redirects to http://localhost:4000/engine/reference/commandline/run/ in the current docs
- http://localhost:4000/v17.99/engine/reference/commandline/run/index.html
    - redirects to http://localhost:4000/engine/reference/commandline/run/index.html  in the current docs

Non existing pages in archive paths
--------------------------------------------------------------------------------

- http://localhost:4000/v17.03/no/such/page/
    - redirects to http://localhost:4000/no/such/page/ in the current docs
    - which shows a 404 not found page

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-28 15:10:24 +01:00
Sebastiaan van Stijn f0e03927c8
NGINX config: enable aio
Enable aio for better performance (see https://www.nginx.com/blog/thread-pools-boost-performance-9x/)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-28 15:10:22 +01:00
Sebastiaan van Stijn e73356f7cd
NGINX configuration: define "root" and "index" at server level
It's best-practice to not define these inside a "location" block
to prevent having to re-define them for each location.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-28 15:10:20 +01:00
Sebastiaan van Stijn a94d10bdd2
NGINX configuration: use relative redirects
Use relative redirects to account for situations where a front-end
proxy is used and the container does not know the public domain and
port.

Before this change, when running locally (on localhost:4000), redirects would omit
the port number, and redirect to localhost _without_ port number:

    curl -v "http://localhost:4000/engine/reference/commandline/run"
    * TCP_NODELAY set
    * Connected to localhost (::1) port 4000 (#0)
    > GET /engine/reference/commandline/run HTTP/1.1
    > Host: localhost:4000
    > User-Agent: curl/7.65.3
    > Accept: */*
    >
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 301 Moved Permanently
    < Server: nginx/1.17.8
    < Date: Fri, 28 Feb 2020 13:46:10 GMT
    < Content-Type: text/html
    < Content-Length: 169
    < Location: http://localhost/engine/reference/commandline/run/
    < Connection: keep-alive

After this change, redirect will be "relative", so redirecting to the correct location:

    curl -v "http://localhost:4000/engine/reference/commandline/run"
    * TCP_NODELAY set
    * Connected to localhost (::1) port 4000 (#0)
    > GET /engine/reference/commandline/run HTTP/1.1
    > Host: localhost:4000
    > User-Agent: curl/7.65.3
    > Accept: */*
    >
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 301 Moved Permanently
    < Server: nginx/1.17.8
    < Date: Fri, 28 Feb 2020 13:39:02 GMT
    < Content-Type: text/html
    < Content-Length: 169
    < Connection: keep-alive
    < Location: /engine/reference/commandline/run/

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-28 15:10:17 +01:00
Sebastiaan van Stijn 1763c42608
Dockerfile: use local nginx configuration
The docs/docker.github.io:nginx-onbuild has not been
updated for a while, and having a local file present
allows for easier updating it (for example, to add
wildcard redirects).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-25 18:33:10 +01:00