Git Product home page Git Product logo

Comments (10)

alessfg avatar alessfg commented on August 18, 2024

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.

jlec avatar jlec commented on August 18, 2024

I am ending up with

return 301 https://True$request_uri;

from ansible-role-nginx-config.

alessfg avatar alessfg commented on August 18, 2024

What value are you using for the https_redirect variable? (Feel free to slightly censor if necessary.)

from ansible-role-nginx-config.

jlec avatar jlec commented on August 18, 2024

I set it to yes

from ansible-role-nginx-config.

jlec avatar jlec commented on August 18, 2024

The vaiable susggest that you will get a redirect to https

from ansible-role-nginx-config.

jlec avatar jlec commented on August 18, 2024

this works

 94             servers:
 95               redirect:
 96                 listen:
 97                   listen_redirect:
 98                     port: 80
 99                     https_redirect: $host

from ansible-role-nginx-config.

alessfg avatar alessfg commented on August 18, 2024

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.

jlec avatar jlec commented on August 18, 2024

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.

Alex-Giaquinto avatar Alex-Giaquinto commented on August 18, 2024

@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.

alessfg avatar alessfg commented on August 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.