Comments (10)
Heya! I just tested this on my end and it's working fine. It's not the best implementation, but the boolean check evaluates to true when the value contains a string that doesn't map to a boolean value. That being said all those checks will be refactored as part of an upcoming templating refactor (no ETA for it yet).
from ansible-role-nginx-config.
I am ending up with
return 301 https://True$request_uri;
from ansible-role-nginx-config.
What value are you using for the https_redirect
variable? (Feel free to slightly censor if necessary.)
from ansible-role-nginx-config.
I set it to yes
from ansible-role-nginx-config.
The vaiable susggest that you will get a redirect to https
from ansible-role-nginx-config.
this works
94 servers:
95 redirect:
96 listen:
97 listen_redirect:
98 port: 80
99 https_redirect: $host
from ansible-role-nginx-config.
Right. Might be worth adding a better comment/explanation as to how it actually works. As it turns out (and you rightfully deduced), it does not actually do a simple HTTPS redirect. You have to specify the URI you want to redirect too.
from ansible-role-nginx-config.
In your jinja code you can drop the second half if it doesn't expect a boolean. _is defined _ should be enough
from ansible-role-nginx-config.
@alessfg sorry to bother you and re-open this thread, could you by any chance point out how to do this with the new template. Just trying to set a permanent redirect (return 301) from 80->443 and having some trouble. Thanks!
from ansible-role-nginx-config.
You would use something along the lines of https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/default/converge.yml#L660-L664, but instead of using the text
parameter, you'd use the url
parameter https://github.com/nginxinc/ansible-role-nginx-config/blob/main/defaults/main/template.yml#L669.
Sadly I don't have time to test a working example right now, but that should hopefully get you on the right path before I would be able to test an example myself.
from ansible-role-nginx-config.
Related Issues (20)
- How to omit load_module: modules/ngx_http_js_module.so HOT 3
- mime.types not included in default nginx configuration HOT 4
- Add `include` support in default.conf.j2 template HOT 1
- Templating error HOT 2
- "mappings" from the "map" directive are not applied to a resulting configuration HOT 2
- Role should restart/reload Nginx when SSL certificates change HOT 3
- How to set "global" variables in the HTTP context HOT 5
- Allow nginx.conf.j2 to create gzip settings HOT 2
- Nested location HOT 2
- Question - nginx-config and proxy rewrite HOT 4
- Question - QUIC config HOT 5
- Enforcing numeric types breaks certain templating patterns. HOT 3
- http2 directive uses enable but http3 uses enabled
- Variables for gzip_static HOT 1
- Logrotate does not format correctly HOT 2
- add map inside stream HOT 3
- Validate configuration HOT 3
- Role version 0.7.1 is not published to the ansible-galaxy repo HOT 1
- set_real_ip_from (ngx_http_realip_module) should be a list HOT 1
- Listen directive in servers['core'] not workign properly HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-role-nginx-config.