Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
mohaja
New Contributor

Redirect or rewrite: Virtual directory to port

Hi,

I have a server running 2 service at different port :

1.2.3.4:5601

1.2.3.4:3000

 

and I want to serve those service by using directory/folder at FortiWeb. eg

public.mydomain.com/abc

public.mydomain.com/xyz

will go to 1.2.3.4:5601  &  1.2.3.4:3000 respectively.

 

How can i get it to work ? Did try using 'HTTP Content Rounting' but failed. Still new to this.

 

Version : FortiWeb-1000D 5.54

 

Thank you.

 

3 REPLIES 3
ede_pfau
Esteemed Contributor III

Content routing is the way to go. Each target (server IP + destination port) is a 'real server', so you need two. It's pretty straightforward.

If your setup fails, post what you've done.


Ede

"Kernel panic: Aiee, killing interrupt handler!"
Ede"Kernel panic: Aiee, killing interrupt handler!"
mohaja

Thats what i thought. My steps as follows

1) Create 2 'Server Pool' with "Type: reverse proxy", "Single Server. One is 1.2.3.4:5601 and another 1.2.3.4:3000. So there is server pool 'abc' and 'xyz'

2) Create 2 'HTTP Content Routing' for each 'Server Pool' from (1).

- One with 'Match Object' -> 'HTTP URL' -> 'Match contains' -> abc

- One with 'Match Object' -> 'HTTP URL' -> 'Match contains' -> xyz

3) Create 1 Policy -> 'Deployment Mode' : 'HTTP Content Routing'. Then add both routing from (2). Just that, no other feature enable (eg http to https)

 

Both giving 404. I think it is cause by the folder public.mydomain.com/abc because if i set one of the routing policy as 'Default' and open just public.mydomain.com , it would go to that specific service either :3000 or :5601

 

I think this would involve URL Rewriting. Suggestion please.

 

Thanks

ede_pfau
Esteemed Contributor III

In CR, it should match 2 criteria:

1- the HOST field e.g. public.mydomain.com

2- the URL e.g. "/abc"

 

That should be all it takes.

Your server should accept the URLs, like "public.mydomain.com/abc".

Try to debug on the server: does it see the request? on which port? does it handle it, or send an error page instead? That would give you an idea which instance rejects the request, the FWB or the web server.


Ede

"Kernel panic: Aiee, killing interrupt handler!"
Ede"Kernel panic: Aiee, killing interrupt handler!"
Labels
Top Kudoed Authors