Apache and SAP rewrite

Discuss practical ways rearrange URLs using mod_rewrite.

Apache and SAP rewrite

Postby kpc » Mon Jan 19, 2009 3:24 am

Hi there

I have a slight issue with a rewrite that I'm doing presently, wondered if anyone had any ideas.

One Apache server inside company DMZ: www.myapache.com
One SAP server inside comany DMZ: www.mysap.com:8000

I've disabled https on both servers just for testing and tested a simple proxied mod_rewrite which all works fine.

At present I'm trying to make the following simple link:

http://www.myapache.com/sap

Redirect to this SAP link:

RewriteRule ^sap http://www.mysap.com:8000/sap/bc/webdyn ... p_customer [P,L]

With the above I get an 'Object Not Found!' Error 404 message and nothing that helpful in the apache error log.

I can get this to work to some degree if I make it a lot simplier

RewriteRule ^sap http://www.mysap.com:8000/sap/bc/webdynpro/ [P,L]

Do I need to create a regular expression and then pass that to the redirect?


UPDATE
---------
Finally got this to work partially, looks like it was an issue with the firewall, however now I'm having problems passing the SAP variable, here's my rule:

RewriteRule ^sap$ http://sapserver:8000/sap/bc/webdynpro/ ... p_customer [P,L]

This rule seems to ignore anything after the '?', instead of going to a specific SAP page it just goes it a SAP generic login screen.

Any ideas?

Thanks

Sorry I realise now I should have posted this in a different forum....
kpc
 
Posts: 12
Joined: Tue Nov 18, 2008 12:55 am

Postby richardk » Tue Jan 20, 2009 3:24 am

Does the query string work on a more simple URL?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby kpc » Wed Jan 21, 2009 2:10 am

richardk wrote:Does the query string work on a more simple URL?


Hi Richard

After trying a number of different things I finally got the main links to rewrite however part of the functionality of the SAP server is a screen that pops up and then uses an iFrame html tag to pull in another page form the same server, but it comes up with an Object not Found! error.

I can't seem to figure out why it does this when all the other URL's seemingly work fine.

Here's my rewrite rules:

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^sap/public/bc/ur/Design2002(/.*)?$ http://sapserver:8000/$0 [P,L]

RewriteRule ^sap/bc(/.*)?$ http://sapserver:8000/$0 [P,L]


Here is the Apache error log:
[Wed Jan 21 08:28:17 2009] [error] [client 192.168.108.1] File does not exist: /srv/www/htdocs/sap(bD1lbiZjPTUwMA==), referer: http://apacheserver/sap/bc/webdynpro/sa ... 4mZCd4-NEW

I managed to pull out the source URL for the iFrame, SAP tries it best to hide the source:

<frame name="4F0E76490FB9B627E1000000C0A86405_A" src="hrrcf_a_posting_apply/~ucfLOADING?sap-contextid=SID%3aANON%3afcrsapqerecci_QE1_00%3aQe1HBYf7UDq1HdFzfT0G_cnKwHeAthLLlU5fLrvf-NEW" noresize onload="onFrameLoaded(frame_A);" onFocus="onFrameFocus(frame_A);">
<frame tabindex="-1" name="4F0E76490FB9B627E1000000C0A86405_B" src="/sap/public/bc/webdynpro/ssr/domain_relax.html?00072002016001001001001001001" noresize onload="onFrameLoaded(frame_B);" onFocus="onFrameFocus(frame_B);">

Any help greatly appreciated...
kpc
 
Posts: 12
Joined: Tue Nov 18, 2008 12:55 am

Postby richardk » Wed Jan 21, 2009 8:18 am

The 404 error is for a request to /sap(bD1lbiZjPTUwMA==).

Try adding
Code: Select all
RewriteRule ^sap\(.+$ http://sapserver:8000/$0 [P,L]

to the end of your .htaccess file.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby kpc » Thu Jan 22, 2009 1:24 am

richardk wrote:The 404 error is for a request to /sap(bD1lbiZjPTUwMA==).

Try adding
Code: Select all
RewriteRule ^sap\(.+$ http://sapserver:8000/$0 [P,L]

to the end of your .htaccess file.


Many thanks Richard that seemed to do the trick. You're a star.
kpc
 
Posts: 12
Joined: Tue Nov 18, 2008 12:55 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 19 guests

cron