Code Monkey home page Code Monkey logo

Comments (2)

kataras avatar kataras commented on May 14, 2024

Hello @Viktor-Vasilev ,

You have two options here (same as with net/http) use a handler for a specific path or use a proxy server which will transfer all incoming requests to the target url.

Check https://github.com/kataras/iris/blob/master/core/host/proxy.go#L31,
you can use it as

// [...]
import "github.com/kataras/iris/core/host"
// [...]
// proxySrv := iris.New()
u, err := url.Parse("https://localhost:4444")
if err != nil {
	t.Fatalf("%v while parsing url", err)
}

p := host.ProxyHandler(u)
// [...]
app.Get("/some/api", iris.FromStd(p)) 

// or start a new whole proxy server:
go host.NewProxy("myproxy:3232", u).ListenAndServe()

These derives from net/http the only thing that Iris does, is some improvements on the url parsing and able to skip tls if your target is a loopback address (when testing).

For more options and advanced features you can take a look at other libraries, anything compatible with net/http is OK to being used inside iris too, therefore you don't have limitations.

from iris.

ignishub avatar ignishub commented on May 14, 2024

Thank you!

from iris.

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.