From 18b4e81f70e7fff6403761b95b2d17e4751b3faa Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 3 Jun 2026 12:58:54 +0000 Subject: [PATCH 01/10] enable markdown file extension access for docs --- .gitignore | 4 +++ Dockerfile | 1 + MARKDOWN_FEATURE.md | 63 +++++++++++++++++++++++++++++++++++++++++++++ nginx/nginx.conf | 27 +++++++++++++++++-- package.json | 3 +++ src/index.ts | 41 +++++++++++++++++++++++++++++ wrangler.toml | 8 ++++++ 7 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 MARKDOWN_FEATURE.md create mode 100644 src/index.ts create mode 100644 wrangler.toml diff --git a/.gitignore b/.gitignore index 6208c37c43..3934bed59e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,10 @@ node_modules .docusaurus .cache-loader +# Cloudflare Worker +dist/ +.wrangler/ + # Misc .DS_Store .env.local diff --git a/Dockerfile b/Dockerfile index a3bc7d8831..f389376577 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,4 +35,5 @@ RUN yarn build --no-minify FROM nginx:1.29 COPY --from=build /app/build/ /usr/share/nginx/html/ +COPY --from=build /app/docs/ /usr/share/nginx/html/docs-source/ COPY nginx /etc/nginx/ diff --git a/MARKDOWN_FEATURE.md b/MARKDOWN_FEATURE.md new file mode 100644 index 0000000000..2618317d5a --- /dev/null +++ b/MARKDOWN_FEATURE.md @@ -0,0 +1,63 @@ +# Markdown File Extension Feature + +This implementation enables raw Markdown source access on all documentation pages via the `.md` file extension. + +## How It Works + +### 1. Cloudflare Worker (`src/index.ts`) +- Intercepts requests ending in `.md` (e.g., `/docs/build/smart-contracts/getting-started/setup.md`) +- Removes the `.md` extension from the path +- Adds the `Accept: text/markdown` header to the request +- Proxies the request back to the origin server +- Returns the response with `Content-Type: text/markdown` + +### 2. Nginx Configuration (`nginx/nginx.conf`) +- Detects the `Accept: text/markdown` header +- Serves the raw markdown source files (`.mdx` or `.md`) instead of the compiled HTML +- Markdown source files are located in `/usr/share/nginx/html/docs-source/` +- Sets appropriate `Content-Type` and `Cache-Control` headers + +### 3. Docker Build (`Dockerfile`) +- Copies the markdown source files to `/usr/share/nginx/html/docs-source/` during the build process +- This makes the source files available to nginx for serving when requested + +## File Paths + +- Cloudflare Worker code: `src/index.ts` +- Cloudflare configuration: `wrangler.toml` +- Nginx configuration: `nginx/nginx.conf` +- Docker configuration: `Dockerfile` + +## Deployment + +### Cloudflare Worker +```bash +# Preview deployment +yarn worker:build + +# Production deployment +yarn worker:deploy +``` + +### Docker Image +The Docker image build automatically includes the markdown source files. No additional steps are needed beyond the standard Docker build process. + +## Example Usage + +```bash +# Request rendered HTML +curl https://developers.stellar.org/docs/build/smart-contracts/getting-started/setup + +# Request raw markdown source +curl https://developers.stellar.org/docs/build/smart-contracts/getting-started/setup.md +``` + +## Cloudflare Configuration + +The worker is configured to run on: +- Production: `developers.stellar.org/*` (zone: `stellar.org`) + +Make sure to: +1. Have the `wrangler` CLI configured with proper authentication +2. Update the zone_name in `wrangler.toml` if using a different domain +3. Configure environment secrets if needed for the worker diff --git a/nginx/nginx.conf b/nginx/nginx.conf index ea3faa8861..a0858f432c 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -2,6 +2,10 @@ events { } http { include mime.types; + types { + text/markdown md; + text/markdown mdx; + } server { root /usr/share/nginx/html; @@ -15,9 +19,23 @@ http { error_page 404 /404.html; location / { - rewrite ^/(.*)/$ /$1 permanent; - try_files $uri $uri.html $uri/index.html =404; + # Handle markdown Accept header requests + set $serve_markdown 0; + if ($http_accept ~* "text/markdown") { + set $serve_markdown 1; + } + + if ($serve_markdown = 1) { + # Try to find the markdown source file + try_files /docs-source$uri.mdx /docs-source$uri.md $uri.html $uri/index.html =404; + } + + if ($serve_markdown = 0) { + rewrite ^/(.*)/$ /$1 permanent; + try_files $uri $uri.html $uri/index.html =404; + } } + location /assets/ { try_files $uri $uri/ =404; } @@ -27,6 +45,11 @@ http { location /icons/ { try_files $uri $uri/ =404; } + location /docs-source/ { + # Serve markdown source files with appropriate headers + add_header 'Content-Type' 'text/markdown; charset=utf-8' always; + add_header 'Cache-Control' 'public, max-age=3600' always; + } location /index.html { add_header 'Cache-Control' 'no-store' always; } diff --git a/package.json b/package.json index b64226f603..2c72226903 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,8 @@ "version": "0.0.0", "private": true, "scripts": { + "worker:build": "wrangler deploy --dry-run", + "worker:deploy": "wrangler deploy", "docusaurus": "docusaurus", "start": "docusaurus start", "build": "docusaurus build", @@ -83,6 +85,7 @@ "@eslint/js": "10.0.1", "@redocly/cli": "2.25.1", "@stellar/prettier-config": "^1.2.0", + "wrangler": "^3.93.1", "eslint": "10.1.0", "glob": "^13.0.6", "husky": "^9.1.7", diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000000..edc1c9f20b --- /dev/null +++ b/src/index.ts @@ -0,0 +1,41 @@ +export default { + async fetch(request: Request): Promise { + const url = new URL(request.url); + const pathname = url.pathname; + + // Check if the request is for a markdown file + if (pathname.endsWith('.md')) { + // Remove the .md extension + const originalPath = pathname.slice(0, -3); + + // Create a new request to the original path with markdown header + const newUrl = new URL(url); + newUrl.pathname = originalPath; + + const newRequest = new Request(newUrl.toString(), { + method: request.method, + headers: new Headers(request.headers), + body: request.body, + cf: { + ...((request as any).cf || {}), + }, + }); + + // Add the Accept: text/markdown header + newRequest.headers.set('Accept', 'text/markdown'); + + // Fetch from origin + const response = await fetch(newRequest); + + // Return the response with appropriate headers + const newResponse = new Response(response.body, response); + newResponse.headers.set('Content-Type', 'text/markdown; charset=utf-8'); + newResponse.headers.set('Cache-Control', 'public, max-age=3600'); + + return newResponse; + } + + // For non-markdown requests, pass through unchanged + return fetch(request); + }, +}; diff --git a/wrangler.toml b/wrangler.toml new file mode 100644 index 0000000000..5b4e6cf591 --- /dev/null +++ b/wrangler.toml @@ -0,0 +1,8 @@ +name = "stellar-docs-markdown" +main = "src/index.ts" +compatibility_date = "2025-06-03" + +[env.production] +routes = [ + { pattern = "developers.stellar.org/*", zone_name = "stellar.org" } +] From c9e12f2678002a5fb44a26e682ede28eb61a8b7e Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 3 Jun 2026 13:33:35 +0000 Subject: [PATCH 02/10] simplify markdown feature to use cloudflare native support --- .gitignore | 4 --- MARKDOWN_FEATURE.md | 59 +++++++++++++++------------------------------ nginx/nginx.conf | 20 +++------------ package.json | 3 --- src/index.ts | 41 ------------------------------- wrangler.toml | 8 ------ 6 files changed, 22 insertions(+), 113 deletions(-) delete mode 100644 src/index.ts delete mode 100644 wrangler.toml diff --git a/.gitignore b/.gitignore index 3934bed59e..6208c37c43 100644 --- a/.gitignore +++ b/.gitignore @@ -8,10 +8,6 @@ node_modules .docusaurus .cache-loader -# Cloudflare Worker -dist/ -.wrangler/ - # Misc .DS_Store .env.local diff --git a/MARKDOWN_FEATURE.md b/MARKDOWN_FEATURE.md index 2618317d5a..89455debe5 100644 --- a/MARKDOWN_FEATURE.md +++ b/MARKDOWN_FEATURE.md @@ -1,63 +1,42 @@ # Markdown File Extension Feature -This implementation enables raw Markdown source access on all documentation pages via the `.md` file extension. +This implementation enables raw Markdown source access on all documentation pages via the `.md` file extension, using Cloudflare's native markdown feature. ## How It Works -### 1. Cloudflare Worker (`src/index.ts`) -- Intercepts requests ending in `.md` (e.g., `/docs/build/smart-contracts/getting-started/setup.md`) -- Removes the `.md` extension from the path -- Adds the `Accept: text/markdown` header to the request -- Proxies the request back to the origin server -- Returns the response with `Content-Type: text/markdown` - -### 2. Nginx Configuration (`nginx/nginx.conf`) -- Detects the `Accept: text/markdown` header -- Serves the raw markdown source files (`.mdx` or `.md`) instead of the compiled HTML +### 1. Nginx Configuration (`nginx/nginx.conf`) +- When a request comes in for a path (e.g., `/docs/build/smart-contracts/getting-started/setup.md`), nginx first tries to serve it as-is +- If that fails, nginx falls back to checking for markdown source files in `/docs-source/` +- Serves the raw markdown source files (`.mdx` or `.md`) with proper `Content-Type: text/markdown` header - Markdown source files are located in `/usr/share/nginx/html/docs-source/` -- Sets appropriate `Content-Type` and `Cache-Control` headers -### 3. Docker Build (`Dockerfile`) -- Copies the markdown source files to `/usr/share/nginx/html/docs-source/` during the build process -- This makes the source files available to nginx for serving when requested +### 2. Docker Build (`Dockerfile`) +- Copies the markdown source files from `/docs/` to `/usr/share/nginx/html/docs-source/` during the build process +- This makes the source files available to nginx for serving + +### 3. Cloudflare Markdown Feature +- Cloudflare automatically detects `Content-Type: text/markdown` responses +- Serves the raw markdown instead of rendering it as HTML +- See: https://blog.cloudflare.com/markdown-for-agents/ ## File Paths -- Cloudflare Worker code: `src/index.ts` -- Cloudflare configuration: `wrangler.toml` - Nginx configuration: `nginx/nginx.conf` - Docker configuration: `Dockerfile` -## Deployment - -### Cloudflare Worker -```bash -# Preview deployment -yarn worker:build - -# Production deployment -yarn worker:deploy -``` - -### Docker Image -The Docker image build automatically includes the markdown source files. No additional steps are needed beyond the standard Docker build process. - ## Example Usage ```bash # Request rendered HTML curl https://developers.stellar.org/docs/build/smart-contracts/getting-started/setup -# Request raw markdown source +# Request raw markdown source (Cloudflare serves the raw markdown) curl https://developers.stellar.org/docs/build/smart-contracts/getting-started/setup.md ``` -## Cloudflare Configuration - -The worker is configured to run on: -- Production: `developers.stellar.org/*` (zone: `stellar.org`) +## Configuration -Make sure to: -1. Have the `wrangler` CLI configured with proper authentication -2. Update the zone_name in `wrangler.toml` if using a different domain -3. Configure environment secrets if needed for the worker +The feature works automatically once deployed: +1. Build and deploy the Docker image +2. Cloudflare will detect markdown responses and serve them appropriately +3. No additional configuration needed diff --git a/nginx/nginx.conf b/nginx/nginx.conf index a0858f432c..1653331bd9 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -19,23 +19,9 @@ http { error_page 404 /404.html; location / { - # Handle markdown Accept header requests - set $serve_markdown 0; - if ($http_accept ~* "text/markdown") { - set $serve_markdown 1; - } - - if ($serve_markdown = 1) { - # Try to find the markdown source file - try_files /docs-source$uri.mdx /docs-source$uri.md $uri.html $uri/index.html =404; - } - - if ($serve_markdown = 0) { - rewrite ^/(.*)/$ /$1 permanent; - try_files $uri $uri.html $uri/index.html =404; - } + rewrite ^/(.*)/$ /$1 permanent; + try_files $uri $uri.html $uri/index.html /docs-source$uri.mdx /docs-source$uri.md =404; } - location /assets/ { try_files $uri $uri/ =404; } @@ -46,7 +32,7 @@ http { try_files $uri $uri/ =404; } location /docs-source/ { - # Serve markdown source files with appropriate headers + # Serve markdown source files with appropriate headers for Cloudflare markdown feature add_header 'Content-Type' 'text/markdown; charset=utf-8' always; add_header 'Cache-Control' 'public, max-age=3600' always; } diff --git a/package.json b/package.json index 2c72226903..b64226f603 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,6 @@ "version": "0.0.0", "private": true, "scripts": { - "worker:build": "wrangler deploy --dry-run", - "worker:deploy": "wrangler deploy", "docusaurus": "docusaurus", "start": "docusaurus start", "build": "docusaurus build", @@ -85,7 +83,6 @@ "@eslint/js": "10.0.1", "@redocly/cli": "2.25.1", "@stellar/prettier-config": "^1.2.0", - "wrangler": "^3.93.1", "eslint": "10.1.0", "glob": "^13.0.6", "husky": "^9.1.7", diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index edc1c9f20b..0000000000 --- a/src/index.ts +++ /dev/null @@ -1,41 +0,0 @@ -export default { - async fetch(request: Request): Promise { - const url = new URL(request.url); - const pathname = url.pathname; - - // Check if the request is for a markdown file - if (pathname.endsWith('.md')) { - // Remove the .md extension - const originalPath = pathname.slice(0, -3); - - // Create a new request to the original path with markdown header - const newUrl = new URL(url); - newUrl.pathname = originalPath; - - const newRequest = new Request(newUrl.toString(), { - method: request.method, - headers: new Headers(request.headers), - body: request.body, - cf: { - ...((request as any).cf || {}), - }, - }); - - // Add the Accept: text/markdown header - newRequest.headers.set('Accept', 'text/markdown'); - - // Fetch from origin - const response = await fetch(newRequest); - - // Return the response with appropriate headers - const newResponse = new Response(response.body, response); - newResponse.headers.set('Content-Type', 'text/markdown; charset=utf-8'); - newResponse.headers.set('Cache-Control', 'public, max-age=3600'); - - return newResponse; - } - - // For non-markdown requests, pass through unchanged - return fetch(request); - }, -}; diff --git a/wrangler.toml b/wrangler.toml deleted file mode 100644 index 5b4e6cf591..0000000000 --- a/wrangler.toml +++ /dev/null @@ -1,8 +0,0 @@ -name = "stellar-docs-markdown" -main = "src/index.ts" -compatibility_date = "2025-06-03" - -[env.production] -routes = [ - { pattern = "developers.stellar.org/*", zone_name = "stellar.org" } -] From b797e6394d3719a6e0e6cbc57b195fb7ede0d81b Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 3 Jun 2026 13:46:38 +0000 Subject: [PATCH 03/10] remove markdown feature documentation --- MARKDOWN_FEATURE.md | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 MARKDOWN_FEATURE.md diff --git a/MARKDOWN_FEATURE.md b/MARKDOWN_FEATURE.md deleted file mode 100644 index 89455debe5..0000000000 --- a/MARKDOWN_FEATURE.md +++ /dev/null @@ -1,42 +0,0 @@ -# Markdown File Extension Feature - -This implementation enables raw Markdown source access on all documentation pages via the `.md` file extension, using Cloudflare's native markdown feature. - -## How It Works - -### 1. Nginx Configuration (`nginx/nginx.conf`) -- When a request comes in for a path (e.g., `/docs/build/smart-contracts/getting-started/setup.md`), nginx first tries to serve it as-is -- If that fails, nginx falls back to checking for markdown source files in `/docs-source/` -- Serves the raw markdown source files (`.mdx` or `.md`) with proper `Content-Type: text/markdown` header -- Markdown source files are located in `/usr/share/nginx/html/docs-source/` - -### 2. Docker Build (`Dockerfile`) -- Copies the markdown source files from `/docs/` to `/usr/share/nginx/html/docs-source/` during the build process -- This makes the source files available to nginx for serving - -### 3. Cloudflare Markdown Feature -- Cloudflare automatically detects `Content-Type: text/markdown` responses -- Serves the raw markdown instead of rendering it as HTML -- See: https://blog.cloudflare.com/markdown-for-agents/ - -## File Paths - -- Nginx configuration: `nginx/nginx.conf` -- Docker configuration: `Dockerfile` - -## Example Usage - -```bash -# Request rendered HTML -curl https://developers.stellar.org/docs/build/smart-contracts/getting-started/setup - -# Request raw markdown source (Cloudflare serves the raw markdown) -curl https://developers.stellar.org/docs/build/smart-contracts/getting-started/setup.md -``` - -## Configuration - -The feature works automatically once deployed: -1. Build and deploy the Docker image -2. Cloudflare will detect markdown responses and serve them appropriately -3. No additional configuration needed From 7d8b73716a80e50fef776be75d971acab44a2b38 Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 3 Jun 2026 13:46:56 +0000 Subject: [PATCH 04/10] support only .md extension, not .mdx --- nginx/nginx.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 1653331bd9..5644156361 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -4,7 +4,6 @@ http { include mime.types; types { text/markdown md; - text/markdown mdx; } server { @@ -20,7 +19,7 @@ http { location / { rewrite ^/(.*)/$ /$1 permanent; - try_files $uri $uri.html $uri/index.html /docs-source$uri.mdx /docs-source$uri.md =404; + try_files $uri $uri.html $uri/index.html /docs-source$uri.md =404; } location /assets/ { try_files $uri $uri/ =404; From d02642f452857c88289f133fe009c35c85231c8c Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 3 Jun 2026 13:47:46 +0000 Subject: [PATCH 05/10] proxy .md requests with accept markdown header --- Dockerfile | 1 - nginx/nginx.conf | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index f389376577..a3bc7d8831 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,5 +35,4 @@ RUN yarn build --no-minify FROM nginx:1.29 COPY --from=build /app/build/ /usr/share/nginx/html/ -COPY --from=build /app/docs/ /usr/share/nginx/html/docs-source/ COPY nginx /etc/nginx/ diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 5644156361..338f0355d8 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -17,9 +17,20 @@ http { index index.html; error_page 404 /404.html; + location ~ \.md$ { + # Strip .md extension and proxy pass with Accept: text/markdown header + rewrite ^(.*)\.md$ $1 break; + proxy_pass http://localhost$uri; + proxy_set_header Accept "text/markdown"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + location / { rewrite ^/(.*)/$ /$1 permanent; - try_files $uri $uri.html $uri/index.html /docs-source$uri.md =404; + try_files $uri $uri.html $uri/index.html =404; } location /assets/ { try_files $uri $uri/ =404; @@ -30,11 +41,6 @@ http { location /icons/ { try_files $uri $uri/ =404; } - location /docs-source/ { - # Serve markdown source files with appropriate headers for Cloudflare markdown feature - add_header 'Content-Type' 'text/markdown; charset=utf-8' always; - add_header 'Cache-Control' 'public, max-age=3600' always; - } location /index.html { add_header 'Cache-Control' 'no-store' always; } From e3b1a048758fdaa19bfbed00c4fff98cfd6d5fdc Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 3 Jun 2026 13:48:33 +0000 Subject: [PATCH 06/10] simplify: rewrite .md internally instead of proxy to localhost --- nginx/nginx.conf | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 338f0355d8..9318ec2fba 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -18,19 +18,14 @@ http { error_page 404 /404.html; location ~ \.md$ { - # Strip .md extension and proxy pass with Accept: text/markdown header - rewrite ^(.*)\.md$ $1 break; - proxy_pass http://localhost$uri; - proxy_set_header Accept "text/markdown"; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + # Strip .md extension and serve with markdown content type + rewrite ^(.*)\.md$ $1 last; } location / { rewrite ^/(.*)/$ /$1 permanent; try_files $uri $uri.html $uri/index.html =404; + add_header Accept "text/markdown" always; } location /assets/ { try_files $uri $uri/ =404; From 8ddb6272a8845f173360ba4a247b247f83750275 Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 3 Jun 2026 13:49:39 +0000 Subject: [PATCH 07/10] proxy .md requests to cloudflare with accept markdown header --- nginx/nginx.conf | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 9318ec2fba..dc3974b086 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -6,6 +6,10 @@ http { text/markdown md; } + upstream cloudflare_origin { + server developers.stellar.org:443; + } + server { root /usr/share/nginx/html; @@ -18,14 +22,19 @@ http { error_page 404 /404.html; location ~ \.md$ { - # Strip .md extension and serve with markdown content type - rewrite ^(.*)\.md$ $1 last; + # Strip .md extension and proxy to Cloudflare with Accept: text/markdown header + rewrite ^(.*)\.md$ $1 break; + proxy_pass https://developers.stellar.org$uri; + proxy_set_header Accept "text/markdown"; + proxy_set_header Host developers.stellar.org; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; } location / { rewrite ^/(.*)/$ /$1 permanent; try_files $uri $uri.html $uri/index.html =404; - add_header Accept "text/markdown" always; } location /assets/ { try_files $uri $uri/ =404; From 0766d374417ff416e200ce408b19bf3bace3faec Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 3 Jun 2026 13:50:26 +0000 Subject: [PATCH 08/10] use original http host for proxy pass --- nginx/nginx.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index dc3974b086..d5aa7b7911 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -22,11 +22,11 @@ http { error_page 404 /404.html; location ~ \.md$ { - # Strip .md extension and proxy to Cloudflare with Accept: text/markdown header + # Strip .md extension and proxy to origin with Accept: text/markdown header rewrite ^(.*)\.md$ $1 break; - proxy_pass https://developers.stellar.org$uri; + proxy_pass https://$http_host$uri; proxy_set_header Accept "text/markdown"; - proxy_set_header Host developers.stellar.org; + proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; From 8d8c1913e1411c971ebbf5b0803c92252528c63d Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 3 Jun 2026 13:50:39 +0000 Subject: [PATCH 09/10] remove unused upstream directive --- nginx/nginx.conf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index d5aa7b7911..97620008f4 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -6,10 +6,6 @@ http { text/markdown md; } - upstream cloudflare_origin { - server developers.stellar.org:443; - } - server { root /usr/share/nginx/html; From 580873969e63e0568a3ec70873c1121837223524 Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 3 Jun 2026 13:50:55 +0000 Subject: [PATCH 10/10] remove unused types directive --- nginx/nginx.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 97620008f4..5f79ac3538 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -2,9 +2,6 @@ events { } http { include mime.types; - types { - text/markdown md; - } server { root /usr/share/nginx/html;