cancel
Showing results for 
Search instead for 
Did you mean: 

Help from the Sample code for Reverse Proxy Filter

Former Member
0 Kudos

Hi everyone,

I'm still struggling on configuring the reverse proxy. In the pdf file for "How to configure the Reverse Proxy Filter for SAP EP 6.0 SP2" I don't know how should i write the code underneath this comment for the provided sample Java Code for the Reverse Proxy Filter:

"/TODO: Enter the code that determinese whether the filter should be activated or not according to request/"

Can anyone help me in this? Maybe help me by writing a template of what the syntax needs to be.

In addition for the Request Wrapper Implementation what needs to go in those brackets?

In the ResponseWrapper Implementation, do you set the redirectURL string to the host name and port you wish to send the redirection too?

Regards,

Jin Bae

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi.

My personal experience is, that filter itself is helpful is you want to manipulate HTTP requests/responses, ending in the same server. That means it is not right reverse proxy. If you want a serious (self-written) proxy, you can directly start writing servlet. The tactique is very similar. If you want a reverse proxy for productive environment, try using Apache (or IIS), the appropriate note is mentioned

Now to your questions.

In my opinion, the first TODO can help to activate or not to activate filter in conditions when filter mapping (see chapter 3.1) does not suffice. Example (a little bit naive and hard to maintain):

you use filter only for extranet users, so you will filter according to IP address:

if (!request.getRemoteAddr().startsWith("158.226.") {

active = true;

}

RequestWrapper&ResponseWrapper are helpful, if you want to manipulate headers and content of transfered HTML, e.g. change URLs. For serious proxy you cannot use HttpServletResponse.sendRedirect(), as it sends the given URL back to client. You can use RequestDispatcher.forward(), but it is done automatically by filter-stuff.

Regards,

Pavol