1

I need to implement my spring boot + cloud gateway app to serve as proxy to a few rules involving multiple sites such as as follows:

usecase 1: http://gateway/admin/** <-> http://site1/** (an admin site)  
usecase 2: http://gateway/rest/** <-> http://site1/rest/** (a REST API)  
usecase 3: http://gateway/<everything else>/** -> http://site2/**

I have so far experimenting on netflix-zuul as described in spring.io tutorials like this:

zuul.routes.admin.path=/admin/**
zuul.routes.admin.url=http://site1
zuul.routes.rest.path=/rest/**
zuul.routes.rest.url=http://site1/rest
ribbon.eureka.enabled=false

Simple 1-to-1 mapping works, e.g., http://gateway/rest/foo <-> http://site1/rest/foo. This might be enough only for usecase #2.

What I'm not sure about is how to proxy the admin site in the same host using a prefix ("admin") as in usecase #1 (i.e., internal links has to be translated also)?

Also, later on, I need to catch everything else in usecase #3 and forward them properly to a second site "site2".

Is Zuul the right tool for this? Kindly show me to the right direction. TIA!

Azzabi Haythem
  • 2,318
  • 7
  • 26
  • 32
  • Have a look at this: https://stackoverflow.com/questions/47092048/how-spring-cloud-gateway-is-different-from-zuul – Simon Martinelli Feb 05 '19 at 18:11
  • Spring Cloud Gateway has the full access to java regexes to transform the url – spencergibb Feb 05 '19 at 18:45
  • How do you usually implement a proxy to entire website? For example, do you route based from referrer? Also, how do you usually handle redirects (302) such that location stays to be "gateway" instead of "site". Some sample code/tutorial pages would be greatly appreciated so that I have something to start on. – SuwekongHilaw Feb 06 '19 at 20:26

0 Answers0