Code Monkey home page Code Monkey logo

Comments (9)

x1ddos avatar x1ddos commented on May 22, 2024

This is already implemented. See example config here:

"host/": "https://another.host"

from weasel.

raphael avatar raphael commented on May 22, 2024

As far as I understand what redirects does is append the redirected path to the redirect target (what I would call a "relative" redirect). What I needed was an "absolute" redirect. Unless I'm missing something I don't think this issue should be closed.

from weasel.

x1ddos avatar x1ddos commented on May 22, 2024

if host is example.com and another.host is another.example.com, then

"host/": "https://another.host"

will redirect:

  • example.com to https://another.example.com
  • example.com/foo/bar?foo=bar to https://another.example.com/foo/bar?foo=bar

Isn't that what you need?

from weasel.

raphael avatar raphael commented on May 22, 2024

No I need to be able to redirect to a different path, not just a different host. If you look at my initial comment you'll see for example:

"/getting-started.html": "https://goa.design/learn/guide"

which redirects:

"goa.design/getting-started.html" to "https://goa.design/learn/guide"

from weasel.

x1ddos avatar x1ddos commented on May 22, 2024

Ah, I see. Sorry for misreading. That can be done with the std http package, no need for weasel:

http.Handle("/getting-started.html", http.RedirectHandler("https://goa.design/learn/guide", 301))

from weasel.

raphael avatar raphael commented on May 22, 2024

Right that's how I ended up implementing the "absolute redirect" feature, just thought it would be useful for these redirects to also appear in the config to keep all these things in one place.

from weasel.

x1ddos avatar x1ddos commented on May 22, 2024

Right. I'm trying to move weasel away from imposing a certain config format. Working on a change to leave the config part up to the user and provide some examples instead.

from weasel.

raphael avatar raphael commented on May 22, 2024

Sounds good, looking forward to it!

from weasel.

x1ddos avatar x1ddos commented on May 22, 2024

Cool. I'll mention you in a PR for a review. Thanks!

from weasel.

Related Issues (10)

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.