I'm wondering if I can have HTTP and HTTPS routes working on the same server. I have a Caddy server that needs to hit the /caddy/ask/ endpoint on the server to check if SSL certificate should be allowed for the subdomains. It works well; except when the certificate of the main domain expires. Then it enters chicken-egg problem and there's no way out.
I've been suggested to use a HTTP endpoint for Caddy's ask_endpoint to avoid this issue. I am wondering if I can access say http://localhost/caddy/ask on my server while the rest of the site functions on https://mydomain.com.
Thank you, @enoch91 . The ask_endpoint needs to respond 200 for allowed subdomains. That is, Caddy will make a get request to the ask_endpoint. I need to handle that inside Laravel.
If I configure this block:
http://localhost:8080 {
# Other configurations for HTTP requests
}
What will be the corresponding entry in my Laravel routes file? Will it be able to invoke a controller on localhost/caddy/ask route?
@thebigk configure your Caddy server to point to the correct Laravel installation and to listen on the appropriate port (in this case, http://localhost:8080). Also, make sure your Laravel development server is running.
define a corresponding route in your Laravel routes file
class CaddyController extends Controller
{
public function handleAskEndpoint()
{
// Handle the ask endpoint logic here
// Respond with a 200 status for allowed subdomains
return response()->json(['status' => 'allowed'], 200);
}
}
Examine the Laravel logs (storage/logs/laravel.log) for any error messages or stack traces related to the request. This might provide more information about why Laravel is responding with a 404.