I want to assign a value in a server action that is the root of my app’s url address with the correct use of http or https… so for my production server it should return
I’m using it with my production site on AWS Elastic Beanstalk with a load balancer… and I get null on my localhost and on the production site.
I’ve asked AWS for help by they don’t seen so sure either… so for now I’ve just done a detection of the subdomain part of the url and worked with that.
I think that might be the case if your load balancer is not communicating securely back to the servers. For example I just setup a site on Amazon Lightsail, using their default CDN. By default the communication from the CDN (perhaps also load balancer) is http even if the channel from the client to the CDN is secure. I suppose that is fine if the channel is otherwise secured internally. So then your code runs on the server and sees an http request. Might have to look at passing proxy headers and other such stuff.
Haven’t done this setup myself, so I’m just throwin’ out ideas.