Not redirecting https requests in private browsing

Has anyone noticed that Caddy doesn’t redirect http requests to https when on private browsing/incognito mode?
It just says No such site at :80

Not happening to me, on any of my domains.

This means that Caddy doesn’t recognize the site you requested as matching any of the sites in your Caddyfile - you may need to check for typos.

This part may be telling - Chrome and Firefox cache redirects. It’s possible that you made a recent change to your Caddyfile and misspelled (or removed) the applicable label on :80, and while it still works on a caching browser, when you go incognito it actually makes a request to Caddy, which is no longer issuing those redirects.

Ok I see the issue, so I basically want to allow http requests to a specific url so as my label I had https://domain.com http://domain.com/api/ which allowed http requests only to that wildcard url successfully and redirected other URLs to https but that looks like it’s causing this issue now. Do you know of a better way to allow http requests to a specific wildcard url like above?

Thanks

Yeah - try:

domain.com http://domain.com/api {
  ...
{

Caddy will match the most specific label it can. The bare domain should tell Caddy to redirect HTTP requests, while the HTTP-specific domain with the /api URI should tell Caddy to serve the site as per the configuration, but over HTTP.

Yeah Caddy is still giving the No such site at :80 when in Private Browsing but the /api links work fine. Do you think Laradock might be causing this issue?

Thanks for the help

I highly doubt it. You’re connecting to Caddy alright, it just thinks that you haven’t specified any config for that host.

Try your old way (with a HTTPS label and a HTTP label for /api), then add another vhost for HTTP on the bare domain and specify a blanket redir to https://{host}{uri}, see if that works.

Thanks man the blanket redir was the solution for me!