From d583b6e2638cc18718669533f9b1c11e6078f70e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 11:48:23 +0000 Subject: [PATCH 1/6] Add http-to-https-redirect sample with RewritePlugin configuration Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> --- samples/http-to-https-redirect/README.md | 72 +++++++++++++++++++ .../http-to-https-redirect/assets/sample.json | 72 +++++++++++++++++++ .../http-to-https-redirect/devproxyrc.json | 20 ++++++ samples/http-to-https-redirect/rewrites.json | 13 ++++ 4 files changed, 177 insertions(+) create mode 100644 samples/http-to-https-redirect/README.md create mode 100644 samples/http-to-https-redirect/assets/sample.json create mode 100644 samples/http-to-https-redirect/devproxyrc.json create mode 100644 samples/http-to-https-redirect/rewrites.json diff --git a/samples/http-to-https-redirect/README.md b/samples/http-to-https-redirect/README.md new file mode 100644 index 0000000..396b67d --- /dev/null +++ b/samples/http-to-https-redirect/README.md @@ -0,0 +1,72 @@ +# Force HTTPS during development + +## Summary + +This sample demonstrates how to use Dev Proxy to automatically rewrite HTTP requests to HTTPS during development. This helps match production security locally and test against HTTPS without certificate hassles. + +## Compatibility + +![Dev Proxy v2.0.0](https://aka.ms/devproxy/badge/v2.0.0) + +## Contributors + +* [GitHub Copilot](https://github.com/copilot) + +## Version history + +Version|Date|Comments +-------|----|-------- +1.0|January 6, 2026|Initial release + +## Minimal path to awesome + +* Clone this repository (or [download this solution as a .ZIP file](https://pnp.github.io/download-partial/?url=https://github.com/pnp/proxy-samples/tree/main/samples/http-to-https-redirect) then unzip it) +* Start Dev Proxy specifying the path to the config file: `devproxy --config-file devproxyrc.json` +* Test the rewrite by making HTTP requests that will be automatically redirected to HTTPS: + ```bash + # This HTTP request will be rewritten to HTTPS + curl -ikx http://127.0.0.1:8000 http://jsonplaceholder.typicode.com/posts/1 + + # Dev Proxy will intercept the request and change it to: + # https://jsonplaceholder.typicode.com/posts/1 + ``` + +## Features + +This sample provides a Dev Proxy configuration that rewrites HTTP requests to HTTPS: + +**Rewrite Rules:** +* HTTP to HTTPS - Rewrites all `http://` URLs to `https://` + +**Key Benefits:** +* **Match production security locally** - Ensure your development environment uses HTTPS just like production +* **Test against HTTPS without certificate hassles** - Dev Proxy handles the protocol rewriting transparently +* **Easy to customize** - Add more rewrite rules in `rewrites.json` for additional URL transformations + +**Additional Rewrite Patterns:** +You can extend the `rewrites.json` file with additional patterns such as: +* Change API versions (v1 to v2) +* Redirect staging to production URLs +* Add/modify query parameters + +Using this sample you can use Dev Proxy to: + +* Automatically force HTTPS for all HTTP requests during development +* Test HTTPS behavior without modifying your application code +* Ensure consistency between development and production environments + +## Help + +We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues. + +You can try looking at [issues related to this sample](https://github.com/pnp/proxy-samples/issues?q=label%3A%22sample%3A%20http-to-https-redirect%22) to see if anybody else is having the same issues. + +If you encounter any issues using this sample, [create a new issue](https://github.com/pnp/proxy-samples/issues/new). + +Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/proxy-samples/issues/new). + +## Disclaimer + +**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** + +![](https://m365-visitor-stats.azurewebsites.net/SamplesGallery/pnp-devproxy-http-to-https-redirect) diff --git a/samples/http-to-https-redirect/assets/sample.json b/samples/http-to-https-redirect/assets/sample.json new file mode 100644 index 0000000..517d4fb --- /dev/null +++ b/samples/http-to-https-redirect/assets/sample.json @@ -0,0 +1,72 @@ +[ + { + "name": "pnp-devproxy-http-to-https-redirect", + "source": "pnp", + "title": "Force HTTPS during development", + "shortDescription": "Automatically rewrite HTTP requests to HTTPS during development using Dev Proxy. Match production security locally and test HTTPS without certificate hassles.", + "url": "https://github.com/pnp/proxy-samples/tree/main/samples/http-to-https-redirect", + "downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/proxy-samples/tree/main/samples/http-to-https-redirect", + "longDescription": [ + "Automatically rewrite HTTP requests to HTTPS during development using Dev Proxy. Match production security locally and test HTTPS without certificate hassles." + ], + "creationDateTime": "2026-01-06", + "updateDateTime": "2026-01-06", + "products": [ + "Dev Proxy" + ], + "metadata": [ + { + "key": "SAMPLE ID", + "value": "http-to-https-redirect" + }, + { + "key": "PRESET", + "value": "Yes" + }, + { + "key": "MOCKS", + "value": "No" + }, + { + "key": "PLUGIN", + "value": "No" + }, + { + "key": "PROXY VERSION", + "value": "v2.0.0" + } + ], + "thumbnails": [ + { + "type": "image", + "order": 100, + "url": "https://github.com/pnp/proxy-samples/raw/main/samples/http-to-https-redirect/assets/screenshot.png", + "alt": "Dev Proxy rewriting HTTP to HTTPS" + } + ], + "authors": [ + { + "gitHubAccount": "copilot", + "pictureUrl": "https://github.com/copilot.png", + "name": "GitHub Copilot" + } + ], + "references": [ + { + "name": "Get started with the Dev Proxy", + "description": "The tutorial will introduce you to the Dev Proxy and show you how to use its features.", + "url": "https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/get-started" + }, + { + "name": "Use preset configurations", + "description": "Instructions on how to configure the Dev Proxy to use a different configuration file.", + "url": "https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/how-to/use-preset-configurations" + }, + { + "name": "RewritePlugin documentation", + "description": "Technical reference documentation for the RewritePlugin.", + "url": "https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/technical-reference/rewriteplugin" + } + ] + } +] diff --git a/samples/http-to-https-redirect/devproxyrc.json b/samples/http-to-https-redirect/devproxyrc.json new file mode 100644 index 0000000..a157df0 --- /dev/null +++ b/samples/http-to-https-redirect/devproxyrc.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.0.0/rc.schema.json", + "plugins": [ + { + "name": "RewritePlugin", + "enabled": true, + "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll", + "configSection": "rewritePlugin" + } + ], + "urlsToWatch": [ + "http://*" + ], + "rewritePlugin": { + "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.0.0/rewriteplugin.schema.json", + "rewritesFile": "rewrites.json" + }, + "logLevel": "information", + "newVersionNotification": "stable" +} diff --git a/samples/http-to-https-redirect/rewrites.json b/samples/http-to-https-redirect/rewrites.json new file mode 100644 index 0000000..5b2da72 --- /dev/null +++ b/samples/http-to-https-redirect/rewrites.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.0.0/rewriteplugin.rewritesfile.schema.json", + "rewrites": [ + { + "in": { + "url": "^http://(.*)" + }, + "out": { + "url": "https://$1" + } + } + ] +} From b52868ee6aa0608576094c08be11650a75d817d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 10 Jan 2026 08:37:11 +0000 Subject: [PATCH 2/6] Update sample to comply with copilot-instructions.md guidelines Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> --- samples/http-to-https-redirect/README.md | 2 +- samples/http-to-https-redirect/assets/README.md | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 samples/http-to-https-redirect/assets/README.md diff --git a/samples/http-to-https-redirect/README.md b/samples/http-to-https-redirect/README.md index 396b67d..4819481 100644 --- a/samples/http-to-https-redirect/README.md +++ b/samples/http-to-https-redirect/README.md @@ -49,7 +49,7 @@ You can extend the `rewrites.json` file with additional patterns such as: * Redirect staging to production URLs * Add/modify query parameters -Using this sample you can use Dev Proxy to: +Using this sample you can use the Dev Proxy to: * Automatically force HTTPS for all HTTP requests during development * Test HTTPS behavior without modifying your application code diff --git a/samples/http-to-https-redirect/assets/README.md b/samples/http-to-https-redirect/assets/README.md new file mode 100644 index 0000000..f2f047d --- /dev/null +++ b/samples/http-to-https-redirect/assets/README.md @@ -0,0 +1,8 @@ +# Screenshot Placeholder + +A screenshot demonstrating Dev Proxy rewriting HTTP requests to HTTPS needs to be added to this folder. + +The screenshot should: +- Be named `screenshot.png` +- Have a resolution of 1920x1080 (preferred) +- Show the terminal output of Dev Proxy intercepting an HTTP request and rewriting it to HTTPS From f9984e81e92839dcd5e9154d32c66e677de852f9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 10 Jan 2026 10:16:58 +0000 Subject: [PATCH 3/6] Update author to waldekmastykarz and dates to 2026-01-10 Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> --- samples/http-to-https-redirect/README.md | 4 ++-- samples/http-to-https-redirect/assets/sample.json | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/http-to-https-redirect/README.md b/samples/http-to-https-redirect/README.md index 4819481..70f1faf 100644 --- a/samples/http-to-https-redirect/README.md +++ b/samples/http-to-https-redirect/README.md @@ -10,13 +10,13 @@ This sample demonstrates how to use Dev Proxy to automatically rewrite HTTP requ ## Contributors -* [GitHub Copilot](https://github.com/copilot) +* [Waldek Mastykarz](https://github.com/waldekmastykarz) ## Version history Version|Date|Comments -------|----|-------- -1.0|January 6, 2026|Initial release +1.0|January 10, 2026|Initial release ## Minimal path to awesome diff --git a/samples/http-to-https-redirect/assets/sample.json b/samples/http-to-https-redirect/assets/sample.json index 517d4fb..730d892 100644 --- a/samples/http-to-https-redirect/assets/sample.json +++ b/samples/http-to-https-redirect/assets/sample.json @@ -9,8 +9,8 @@ "longDescription": [ "Automatically rewrite HTTP requests to HTTPS during development using Dev Proxy. Match production security locally and test HTTPS without certificate hassles." ], - "creationDateTime": "2026-01-06", - "updateDateTime": "2026-01-06", + "creationDateTime": "2026-01-10", + "updateDateTime": "2026-01-10", "products": [ "Dev Proxy" ], @@ -46,9 +46,9 @@ ], "authors": [ { - "gitHubAccount": "copilot", - "pictureUrl": "https://github.com/copilot.png", - "name": "GitHub Copilot" + "gitHubAccount": "waldekmastykarz", + "pictureUrl": "https://github.com/waldekmastykarz.png", + "name": "Waldek Mastykarz" } ], "references": [ From 811e4903228dca528e567bf34ffef06aff127783 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 10 Jan 2026 14:47:13 +0000 Subject: [PATCH 4/6] Remove default config values to keep config lean Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> --- samples/http-to-https-redirect/devproxyrc.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/samples/http-to-https-redirect/devproxyrc.json b/samples/http-to-https-redirect/devproxyrc.json index a157df0..decd281 100644 --- a/samples/http-to-https-redirect/devproxyrc.json +++ b/samples/http-to-https-redirect/devproxyrc.json @@ -14,7 +14,5 @@ "rewritePlugin": { "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.0.0/rewriteplugin.schema.json", "rewritesFile": "rewrites.json" - }, - "logLevel": "information", - "newVersionNotification": "stable" + } } From 72caf9c4d2f9cf05f6c5ff8a3e793c481fdd29c9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 10 Jan 2026 14:59:25 +0000 Subject: [PATCH 5/6] Move config files to .devproxy folder Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> --- .../http-to-https-redirect/{ => .devproxy}/devproxyrc.json | 0 .../http-to-https-redirect/{ => .devproxy}/rewrites.json | 0 samples/http-to-https-redirect/README.md | 6 +++--- 3 files changed, 3 insertions(+), 3 deletions(-) rename samples/http-to-https-redirect/{ => .devproxy}/devproxyrc.json (100%) rename samples/http-to-https-redirect/{ => .devproxy}/rewrites.json (100%) diff --git a/samples/http-to-https-redirect/devproxyrc.json b/samples/http-to-https-redirect/.devproxy/devproxyrc.json similarity index 100% rename from samples/http-to-https-redirect/devproxyrc.json rename to samples/http-to-https-redirect/.devproxy/devproxyrc.json diff --git a/samples/http-to-https-redirect/rewrites.json b/samples/http-to-https-redirect/.devproxy/rewrites.json similarity index 100% rename from samples/http-to-https-redirect/rewrites.json rename to samples/http-to-https-redirect/.devproxy/rewrites.json diff --git a/samples/http-to-https-redirect/README.md b/samples/http-to-https-redirect/README.md index 70f1faf..d94bae3 100644 --- a/samples/http-to-https-redirect/README.md +++ b/samples/http-to-https-redirect/README.md @@ -21,7 +21,7 @@ Version|Date|Comments ## Minimal path to awesome * Clone this repository (or [download this solution as a .ZIP file](https://pnp.github.io/download-partial/?url=https://github.com/pnp/proxy-samples/tree/main/samples/http-to-https-redirect) then unzip it) -* Start Dev Proxy specifying the path to the config file: `devproxy --config-file devproxyrc.json` +* Start Dev Proxy specifying the path to the config file: `devproxy --config-file .devproxy/devproxyrc.json` * Test the rewrite by making HTTP requests that will be automatically redirected to HTTPS: ```bash # This HTTP request will be rewritten to HTTPS @@ -41,10 +41,10 @@ This sample provides a Dev Proxy configuration that rewrites HTTP requests to HT **Key Benefits:** * **Match production security locally** - Ensure your development environment uses HTTPS just like production * **Test against HTTPS without certificate hassles** - Dev Proxy handles the protocol rewriting transparently -* **Easy to customize** - Add more rewrite rules in `rewrites.json` for additional URL transformations +* **Easy to customize** - Add more rewrite rules in `.devproxy/rewrites.json` for additional URL transformations **Additional Rewrite Patterns:** -You can extend the `rewrites.json` file with additional patterns such as: +You can extend the `.devproxy/rewrites.json` file with additional patterns such as: * Change API versions (v1 to v2) * Redirect staging to production URLs * Add/modify query parameters From bbe11e8db5d673236037d71dd66100ed51c2b33a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 11:08:34 +0000 Subject: [PATCH 6/6] Simplify devproxy command since .devproxy config is auto-loaded Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> --- samples/http-to-https-redirect/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/http-to-https-redirect/README.md b/samples/http-to-https-redirect/README.md index d94bae3..dd793d2 100644 --- a/samples/http-to-https-redirect/README.md +++ b/samples/http-to-https-redirect/README.md @@ -21,7 +21,7 @@ Version|Date|Comments ## Minimal path to awesome * Clone this repository (or [download this solution as a .ZIP file](https://pnp.github.io/download-partial/?url=https://github.com/pnp/proxy-samples/tree/main/samples/http-to-https-redirect) then unzip it) -* Start Dev Proxy specifying the path to the config file: `devproxy --config-file .devproxy/devproxyrc.json` +* Start Dev Proxy: `devproxy` * Test the rewrite by making HTTP requests that will be automatically redirected to HTTPS: ```bash # This HTTP request will be rewritten to HTTPS