-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/wordpress: Use https by default for caddy #375375
base: master
Are you sure you want to change the base?
Conversation
cc @onny who originally added caddy support for wordpress. |
Looks like a lot of existing formatting issues. I can fix it in a followup if y'all want. |
f7cf5c8
to
1566958
Compare
I think I was hitting #337982. Had to add |
Thank you, this is great :) An entry to the release notes like here #327743 would be nice 👍 |
Previously, `http://` scheme was hard coded into the caddy config if `webserver = "caddy"` was chosen. This is fine for local testing, but is problematic if you want your nixos host to be public facing. In the public facing case, you generally want to be using TLS. But since the wordpress module generates the caddyfile rule, the user's nixos config cannot easily change it to also allow https. An alternative would be to reverse proxy an https rule to the generated http rule, but that's somewhat questionable as there's not an internal http endpoint to proxy to. It might be possible but I couldn't figure it out. So simplify by omitting the scheme. This causes caddy to use https by default and 301 redirect any http requests to the https endpoint. Caddy will just do the right thing if it's being hosted on a local/internal hostname (self sign certificates). This should be backwards compatible with previous default if users are using reasonable browsers/tools.
Thanks, done! |
1566958
to
71dc31f
Compare
Previously,
http://
scheme was hard coded into the caddy config ifwebserver = "caddy"
was chosen. This is fine for local testing, but is problematic if you want your nixos host to be public facing.In the public facing case, you generally want to be using TLS. But since the wordpress module generates the caddyfile rule, the user's nixos config cannot easily change it to also allow https.
An alternative would be to reverse proxy an https rule to the generated http rule, but that's somewhat questionable as there's not an internal http endpoint to proxy to. It might be possible but I couldn't figure it out.
So simplify by omitting the scheme. This causes caddy to use https by default and 301 redirect any http requests to the https endpoint. Caddy will just do the right thing if it's being hosted on a local/internal hostname (self sign certificates).
This should be backwards compatible with previous default if users are using reasonable browsers/tools.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.