middleware redirect from HTTPS to HTTP
I have set up this middleware to run on all my authenticated routes :
(simplified version) (notice the commented lines setting the protocol)
It all works works well, on page loads.
I am using HTMX and, without some extra work, all my ajax requests are also served through this middleware (by design)
Everything works well, on my computer, working with HTTP.
Once I run it in production (Bun, Hono, proxied through NGINX), my ajax requests stop working, as this middleware redirects to HTTP instead of HTTPS.
so, if i uncomment the lines setting
This feels like undesired behaviour, is it?
Thank you
(simplified version) (notice the commented lines setting the protocol)
It all works works well, on page loads.
I am using HTMX and, without some extra work, all my ajax requests are also served through this middleware (by design)
Everything works well, on my computer, working with HTTP.
Once I run it in production (Bun, Hono, proxied through NGINX), my ajax requests stop working, as this middleware redirects to HTTP instead of HTTPS.
so, if i uncomment the lines setting
url.protocol = 'https, it now works.This feels like undesired behaviour, is it?
Thank you