Redirecting http traffic

How can I redirect http traffic to https in my router?

To redirect HTTP traffic to HTTPS in your router, you can set up a rule in your Edgio configuration to enforce HTTPS. This can be done by checking the protocol of incoming requests and redirecting HTTP requests to HTTPS.

Here’s a generic example of how you might configure your router to redirect HTTP to HTTPS using EdgeJS:

export default new Router()
  .match({ protocol: 'http' }, ({ redirect }) => {
    redirect('https://' + + request.path);
  // ... other routes and configurations

In the above code snippet, we’re defining a match condition that checks if the incoming request’s protocol is http. If it is, we use the redirect function to send the client to the HTTPS version of the requested URL.

Please note that the actual implementation may vary based on your specific setup and requirements. You should consult the Edgio documentation for detailed instructions on how to configure your router for your particular use case.


Edgio Answers may provide inaccurate information and should be verified. Consult our official documentation for more information.