From 8f657f353ce1e5fc46259ee003cbdfb2d057a4d6 Mon Sep 17 00:00:00 2001 From: Gautam Kumar Date: Thu, 25 Jun 2026 22:21:11 +0530 Subject: [PATCH 1/2] fix missing 4.x doc links The site nav only linked to 5.x API docs, and there was no fallback for 4.x URLs. Users following old links to /4.x/okhttp/okhttp3/ would hit dead ends. - Add 4.x API entry to mkdocs.yml nav alongside 5.x - Generate a redirect page (docs/4.x/) in both deploy_website.sh and test_docs.sh that maps /4.x/* paths to their 5.x equivalents - Works with both JS-enabled and no-JS browsers (meta refresh fallback) Fixes #9156 --- deploy_website.sh | 24 ++++++++++++++++++++++++ docs/4.x/okhttp/okhttp3/index.html | 18 ++++++++++++++++++ mkdocs.yml | 4 +++- test_docs.sh | 24 ++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 docs/4.x/okhttp/okhttp3/index.html diff --git a/deploy_website.sh b/deploy_website.sh index 1b814350ce3b..b144dbad51a8 100755 --- a/deploy_website.sh +++ b/deploy_website.sh @@ -30,6 +30,30 @@ cat README.md | grep -v 'project website' > docs/index.md cp CHANGELOG.md docs/changelogs/changelog.md cp CONTRIBUTING.md docs/contribute/contributing.md +# Create a redirect page for OkHttp 4.x API docs. +# The 4.x docs redirect to 5.x since the API surface is compatible. +mkdir -p docs/4.x/okhttp/okhttp3 +cat > docs/4.x/okhttp/okhttp3/index.html << 'REDIRECT' + + + + + Redirecting… + + + + +

OkHttp 4.x API docs have moved. Redirecting to 5.x API docs

+ + +REDIRECT + # Build the site and push the new files up to GitHub python3 -m venv venv source venv/bin/activate diff --git a/docs/4.x/okhttp/okhttp3/index.html b/docs/4.x/okhttp/okhttp3/index.html new file mode 100644 index 000000000000..d313a8e1ad2f --- /dev/null +++ b/docs/4.x/okhttp/okhttp3/index.html @@ -0,0 +1,18 @@ + + + + + Redirecting… + + + + +

OkHttp 4.x API docs have moved. Redirecting to 5.x API docs

+ + diff --git a/mkdocs.yml b/mkdocs.yml index 2490b3e5dd3b..a8a6af66ae74 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -102,7 +102,9 @@ nav: - 'Providers': security/security_providers.md - 'Configuration History': security/tls_configuration_history.md - 'Works with OkHttp': works_with_okhttp.md - - 'API': 5.x/okhttp/okhttp3/ + - 'API': + - '5.x': 5.x/okhttp/okhttp3/ + - '4.x': 4.x/okhttp/okhttp3/ - 'Change Logs': - 'Change Log': changelogs/changelog.md - '4.x Change Log': changelogs/changelog_4x.md diff --git a/test_docs.sh b/test_docs.sh index fdf90a543556..6e99917a5ef1 100755 --- a/test_docs.sh +++ b/test_docs.sh @@ -21,5 +21,29 @@ cat README.md | grep -v 'project website' > docs/index.md cp CHANGELOG.md docs/changelogs/changelog.md cp CONTRIBUTING.md docs/contribute/contributing.md +# Create a redirect page for OkHttp 4.x API docs. +# The 4.x docs redirect to 5.x since the API surface is compatible. +mkdir -p docs/4.x/okhttp/okhttp3 +cat > docs/4.x/okhttp/okhttp3/index.html << 'REDIRECT' + + + + + Redirecting… + + + + +

OkHttp 4.x API docs have moved. Redirecting to 5.x API docs

+ + +REDIRECT + # Build the site locally mkdocs build From 3555efe19cb7a417cbdfbb037580599b4dbc9678 Mon Sep 17 00:00:00 2001 From: GautamKumarOffical Date: Fri, 26 Jun 2026 07:35:49 +0530 Subject: [PATCH 2/2] Remove checked-in redirect HTML and 4.x nav entry - Delete docs/4.x/okhttp/okhttp3/index.html; deploy_website.sh generates it during build - Revert API nav back to simple 5.x link since 4.x just redirects to 5.x Addresses review comments from JakeWharton on #9510 --- docs/4.x/okhttp/okhttp3/index.html | 18 ------------------ mkdocs.yml | 4 +--- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 docs/4.x/okhttp/okhttp3/index.html diff --git a/docs/4.x/okhttp/okhttp3/index.html b/docs/4.x/okhttp/okhttp3/index.html deleted file mode 100644 index d313a8e1ad2f..000000000000 --- a/docs/4.x/okhttp/okhttp3/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Redirecting… - - - - -

OkHttp 4.x API docs have moved. Redirecting to 5.x API docs

- - diff --git a/mkdocs.yml b/mkdocs.yml index a8a6af66ae74..2490b3e5dd3b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -102,9 +102,7 @@ nav: - 'Providers': security/security_providers.md - 'Configuration History': security/tls_configuration_history.md - 'Works with OkHttp': works_with_okhttp.md - - 'API': - - '5.x': 5.x/okhttp/okhttp3/ - - '4.x': 4.x/okhttp/okhttp3/ + - 'API': 5.x/okhttp/okhttp3/ - 'Change Logs': - 'Change Log': changelogs/changelog.md - '4.x Change Log': changelogs/changelog_4x.md