Logo

dev-resources.site

for different kinds of informations.

How to test https on localhost with help of Caddy

Published at
12/29/2022
Categories
https
webdev
localhost
caddyserver
Author
arpitsr
Author
7 person written this
arpitsr
open
How to test https on localhost with help of Caddy

In this post I am going to talk about testing https on localhost. Testing https on localhost is difficult of ssl certificates issue.

If you want to test integration of https cookies, public webhooks etc you need https enabled web endpoint. Also any browser based https flows become difficult while testing on localhost.

Today we are going to use an awesome open source tool Caddyserver.

Assuming we are running a server at localhost:3000

To use CaddyServer with reverse proxy to port 3000 for HTTPS on localhost, follow these steps:
Find install instructions for Caddy on - https://caddyserver.com/docs/install
Once installed open up a terminal and run below command

caddy reverse-proxy --to :3000

CaddyServer will generate a self-signed certificate for localhost and enable HTTPS on port 443.

To access the HTTPS version of your localhost website, enter https://localhost in your web browser. CaddyServer will reverse proxy all requests to port 3000.

localhost Article's
30 articles in total
Favicon
Accessing a Laptop's Server on Port 80 from Your Phone via Wireless Debugging
Favicon
Expose Your Localhost to a Public URL
Favicon
Comprehensive Guide to Localhost IP Addresses: 127.0.0.1
Favicon
Exploring Localhost 127.0.0.1:62893: Setup and Usage Guide
Favicon
Exploring Localhost 127.0.0.1:49342: Setup and Usage Guide
Favicon
127.0.0.1:57573: Benefits, Comparisons, and Troubleshooting Guide
Favicon
Understanding Localhost Networking: A Comprehensive Guide
Favicon
Access Localhost on Mobile Within the Same Network
Favicon
Set Up Your Own Local GitLab Server | Self-hosted GitLab
Favicon
Run your Sveltekit (or any vite) localhost server with HTTPS
Favicon
Change your Sveltekit (or any vite-powered) dev server localhost port
Favicon
How to Install or Download MongoDB 7 on Windows 10/11 | Step by Step Guide for Localhost
Favicon
What is Localhost in Development Mode?
Favicon
How to share your "localhost" with the world
Favicon
Trabalhando com AWS em um ambiente localhost
Favicon
Best DX for cookies on localhost
Favicon
How to access your site in mobile phone during development
Favicon
Fix MySQL Error: Access Denied for User ‘root’@’localhost’
Favicon
Setting up an Alias for a Directory in Apache2 Server
Favicon
How can I set up SSL on localhost (https://localhost/)?
Favicon
How to test https on localhost with help of Caddy
Favicon
How To Use Visual Studio Dev Tunnels to Receive Webhooks on Localhost
Favicon
How to Preview localhost Website on Mobile Phone
Favicon
How to stop Localhost server running on multiple ports.
Favicon
Let's Run PHP On Localhost with XAMPP Server
Favicon
How to Fix the XAMPP Error “MySQL Shutdown Unexpectedly”
Favicon
Nuxt and Cloudflare, how to get SSR working (2 settings)
Favicon
How to use LocalXpose with a Localhost WordPress
Favicon
What Happens When You Visit http://localhost - A Closer Look
Favicon
Share your localhost with Cloudflare tunnels

Featured ones: