How to dynamically route HTTPS traffic to LXD instances

Sure, You can make second nginx vhost configuration just for localhost:

server {
listen 80;
listen 443 ssl;

resolver 10.243.93.1;

server_name localhost;

location ~^/(?<container>\w+) {
proxy_pass http://$container.lxd/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

1 Like

Strange…
This config didn’t work for some reason.

Although there are no errors

I think I’m doing something wrong

Can you please help?

Text editor reorder line 7. It should be: proxy_pass http://$container.lxd :80/; without space.

1 Like

@Miso-K It’s incredible!

It worked!

I don’t know how to thank you
You are the best!

Thank you all very much for your participation!

Everyone was so helpful, I don’t even know how to thank everyone!

I hope this post helps a lot of people!

Thank you all for your attention!