Tagged: openig, Reverse proxy
This topic has 7 replies, 4 voices, and was last updated 5 years, 8 months ago by Fehmi M’Barek.
-
AuthorPosts
-
October 18, 2016 at 5:52 pm #13777
Fehmi M’Barek
ParticipantHi @ all,
is there a possibilty to use OpenIG as a Reverse Proxy similar to NGINX or Apache in order to manage different WebSite on different Hosts? (On NGINX they call it “Server Blocks”)
It would be very helpful if you would help me out with the router configuration (config.json) and also the different routes.
Thanks in advanced.
October 19, 2016 at 10:06 am #13781Guillaume Sauthier
ModeratorYes you can handle request targeting different hosts with OpenIG.
Part of the configuration depends on your DNS settings (that maps
openig.example.com
,www.acme.com
, to the IP where your web container hosting OpenIG runs).The other part depends on your routes configuration, you have to check in the
condition
that the incoming request has the hostname you want:{ "condition": "${request.uri.host == 'www.acme.com' and ...}" }
You don’t need any
config.json
to make that work, just provide a route JSON configuration in your${openig.base}/config/routes/
directory.October 19, 2016 at 1:38 pm #13785Fehmi M’Barek
ParticipantHi Guillaume,
first of all, thank you for the prompt reply.
Do this listing look like a wright Route?
{ "heap": { "objects": [ { "name": "myHandler", "type": "ClientHandler", "config": { "baseURI": "http://1.1.1.1:8080" } } ] }, "handler": "myHandler", "condition": "${request.uri.host, == 'www.acme.com')}" }
Thanks in advanced
October 19, 2016 at 2:27 pm #13787Guillaume Sauthier
ModeratorbaseURI
should be a top level attribute, next tocondition
Otherwise, that LGTMOctober 20, 2016 at 9:16 am #13802Laurent Vaills
ParticipantBy the way, be careful : there is also typo in your condition : a comma after the host.
So here is the configuration, with the Guillaume’s advice (baseURI is a decorator, not a raw config of ClientHandler) :
{ "heap": { "objects": [ { "name": "myHandler", "type": "ClientHandler", "baseURI": "http://1.1.1.1:8080" } ] }, "handler": "myHandler", "condition": "${request.uri.host == 'www.acme.com')}" }
-
This reply was modified 5 years, 9 months ago by
Laurent Vaills.
-
This reply was modified 5 years, 9 months ago by
Laurent Vaills.
October 20, 2016 at 11:01 am #13810Fehmi M’Barek
Participantthanks a lot Laurent
November 16, 2016 at 8:20 pm #14321Kabi Patt
ParticipantHi
I am new to OpenIG. Few questions on the configuration mentioned above.(1) “baseURI”: “http://1.1.1.1:8080” :- Is this the IP where the target app “www.acme.com” is hosted ?
(2) When to use config.json file vs “../routes/xxx.json” . Can the config.json file be empty ?Thanks,
Kabi-
This reply was modified 5 years, 8 months ago by
Kabi Patt.
November 17, 2016 at 3:21 pm #14336Fehmi M’Barek
ParticipantHi Kabi,
(1) yes.
(2) It is not necessary to have a config.json in /home/user/.openig/config. If you don’t create one, the a default configuration will be load. In my environment I am not using a config.json. I have only routes in /home/user/.openig/config/routesbest regards,
Fehmi -
This reply was modified 5 years, 9 months ago by
-
AuthorPosts
You must be logged in to reply to this topic.