Giter VIP home page Giter VIP logo

Comments (7)

hongzhidao avatar hongzhidao commented on July 26, 2024 1

Hi,
Take a look at the document (https://unit.nginx.org/scripting/#scripting).
There are only a few common variables supported for now.

Btw, we'll support the variables accessing with njs in the next version.
Here's the PR(#1024), welcome to try it.

from unit.

tippexs avatar tippexs commented on July 26, 2024 1

Good morning! The uri does NOT include the arguments. We have to use request_uri for that. The request_uri will be available in NJS within the next release as mentioned.

Furthermore I think it will be benefitial for everybody if we would provide NJS functions in files easy to consume for such use cases.

Without saying: We have to provide a easy to use solution for such use cases for users like @veremax! So, thanks for testing this @veremax and letting us know. We are working on a solution that will make this A LOT! easier with Unit 1.32 which we are about to ship within the next 4 weeks.

from unit.

tippexs avatar tippexs commented on July 26, 2024 1

I think we should keep this issue open as long as we are working on resolving the issue with the request arguments and rewrites.

from unit.

callahad avatar callahad commented on July 26, 2024

@tippexs Are there cleaner ways to strip www. from hostnames and provide http->https redirection?

from unit.

lcrilly avatar lcrilly commented on July 26, 2024

For compactness (don't hate me!)

{
  "action": {
    "return": 301,
    "location": "`${'https://' + host.substr(host.startsWith('www.')*4) + uri}`"
  }
}

from unit.

veremax avatar veremax commented on July 26, 2024

For compactness (don't hate me!)

{
  "action": {
    "return": 301,
    "location": "`${'https://' + host.substr(host.startsWith('www.')*4) + uri}`"
  }
}

Unfortunately, after redirection you will lose parameters after "?" (query_string)

from unit.

veremax avatar veremax commented on July 26, 2024

@tippexs @lcrilly @hongzhidao @
Thank you very much!

from unit.

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.