Skip to content

Sample: http-to-https-redirect - Force HTTPS during development #30

@waldekmastykarz

Description

@waldekmastykarz

Summary

Create a sample that rewrites HTTP requests to HTTPS during development.

Plugins to use

  • RewritePlugin - rewrites request URLs using regex

What to build

  • Configure URL rewriting from HTTP to HTTPS
  • Other useful rewrite patterns:
    • Change API versions (v1 to v2)
    • Redirect staging to production URLs
    • Add/modify query parameters

Configuration example

{
  "rewritePlugin": {
    "rewritesFile": "rewrites.json"
  }
}

rewrites.json:

{
  "rewrites": [
    {
      "in": { "url": "^http://(.*)" },
      "out": { "url": "https://$1" }
    }
  ]
}

Why this is compelling

Match production security locally. Test against HTTPS without certificate hassles.

Reference docs

  • RewritePlugin technical reference

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions