Rupali,

On 3/25/22 11:28, rupali singh wrote:
hi chris,

Apologies for typo mistakes.

business user are using url :   https://xyz.ae/apex/f?p=1001
<https://xyz.com/apex/f?p=1001>   to login into apex application and login
is working fine.

xyz.ae is published in our F5 which is pointing to tomcat server on port
8080  hence im not worried about xyz.ae

for making is simple for user we want to rename f?p=1001
<https://xyz.com/apex/f?p=1001>   to myapp
so business user will use https://xyz.ae/apex/myapp
<https://xyz.com/aorx/myapp>

So our requirement is  :   in url we want to replace f?p=1001
<https://xyz.com/apex/f?p=1001> to myapp


tried below but not working

RewriteCond %{QUERY_STRING} p=1001
RewriteRule ^/f$ /apex/myapp

It looks like you are doing this backward: your rewrite rule will take a URL coming from a user (at the time they request it!) which looks like this:

https://xyz.ae/apex/f?p=1001

and re-write the URL to:

/apex/myapp

You want to do the opposite: the user supplies the URL /apex/myapp and you internally convert it to /apex/f?p=1001

Right?

You want users to use the "friendly" URLs, not the internal system.

rewrite.config location :
/opt/tomcat/apache-tomcat-9.0.54/instance/webapps/ROOT/WEB-INF/rewrite.config

This is the major problem: you have put your rewrite rules into the ROOT web application (context path=/), but your request is being sent to the web application deployed into the /apex context path.

You need to:

1. Move your file to .../instance/webapps/apex/WEB-INF/rewrite.config
2. Remove the "/apex" from the beginning of all your URLs in rewrite.config

curl output:
curl -D- 'localhost:8080/apex/f?p=10001'
HTTP/1.1 302
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Referrer-Policy: strict-origin-when-cross-origin
Location: https://localhost/apex/workspace/r/abcrelease10001123100/home
Transfer-Encoding: chunked
Date: Fri, 25 Mar 2022 15:18:16 GMT

Hmmmmm. So you really *do* want to re-write non-friendly URLs into friendly ones. I'm very confused.

So you are expecting a 302 response from Tomcat but pointing to /apex/myapp ?

What component of your system is returning the 302 above?

-chris

On Fri, 25 Mar 2022 at 16:52, Christopher Schultz <
ch...@christopherschultz.net> wrote:

Rupali,

This has gone around in circles for a while with no progress. Can you
please:

1. Show examples of what you would like. Specific examples, like:

"I expect that when requesting http://xyz.ae/apex/?f=1001"; I get a 302
redirect to http://xyz.ae/apex/myapp";

That's what you are asking for, but I suspect that what you really want
is the reverse: users who request /myapp actually get "?f=1001".

This is further complicated by the fact that all your URLs show as
ayx.ae in text, but then have <xyz.com> added to the end for some
reason. Which is it?

Do you want an HTTP redirect? If so, what kind? Or do you want your
server to proxy from one URL to the other, so the client doesn't know
it's happening?

2. Which component should be responsible for all of this? You have
several networking components to choose from:

a. F5 load balancer
b. Oracle Apex
c. Apache Tomcat

Why have you decided to re-write your application's URLs at the Tomcat
level and not somewhere further up the chain?

3. Show exactly what you currently have in your rewrite config file, and
exactly where that rewrite configuration file is on the disk.

Going back to your original post, lots of things are confusing:

i. The URLs are inconsistent (.ae va .com, apex vs aorx)

ii. You appear to be asking to redirect from non-friendly URLs to
friendly URLs which doesn't make any sense. Perhaps this is a
terminology issue. You want clients to use the friendly URLs
(/apex/myapp) and then get what they would have received had they called
/f?p=1001 right?

iii. You are redirecting /myapp to /myapp in your example, which
accomplishes nothing. You also have the same rule twice.

This should be as simple as:

RewriteRule "^/f?p=1001" "/myapp"

... but it's not, because RewriteRule only looks at the path and not the
query string, so you need a separate condition. I'll repeat what Felix
(almost) posted a few days ago, which should be correct:

RewriteCond %{QUERY_STRING} p=1001
RewriteRule ^/f$ /apex/myapp

I don't think you even want the [R] flag because if you do that, the
client will see the URL change to the unfriendly URL, and the point is
to hide that from them, right?

The last thing to do is to make sure the file is *in the right place*.
No amount of configuration in C:\Windows\rewrite.config is going to have
any effect unless you have a very strange configuration.

-chris

On 3/24/22 14:23, rupali singh wrote:
hi,

yes context name is apex.

   https://xyz.ae/apex/f?p=1001 <https://xyz.com/apex/f?p=1001>   to
https://xyz.ae/apex/myapp <https://xyz.com/aorx/myapp>

we dont want to change xyz.ae that will name remain as it is , we want
to
change f?p=1001 <https://xyz.com/apex/f?p=1001> to myapp



On Wed, 23 Mar 2022 at 19:23, Felix Schumacher <
felix.schumac...@internetallee.de> wrote:



Am 23. März 2022 12:14:25 MEZ schrieb rupali singh <
rupali.r.si...@gmail.com>:
Hi Chris,

I already tried with fully qualified name but its not working

Can you be more specific, what you tried?

Is Chris right and your context name is apex?

Felix

On Tue, Mar 22, 2022, 7:15 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

All,

On 3/21/22 10:19, Felix Schumacher wrote:

Am 21.03.22 um 06:39 schrieb rupali singh:
Hi Felix,

location of context.xml file is

    cat context.xml| grep RewriteValve
       <Valve
className="org.apache.catalina.valves.rewrite.RewriteValve"
/>
    pwd
/opt/tomcat/apache-tomcat-9.0.54/instance/conf
That context.xml is thought to be a default template for all
installed
webapps. It will work, but remember, that every installed webapp will
get its own copy of a rewrite valve.

+1

This is probably the problem.

more



/opt/tomcat/apache-tomcat-9.0.54/instance/webapps/ROOT/WEB-INF/rewrite.config
RewriteCond %{QUERY_STRING} p=10001
RewriteRule ^/apex/f$ /apex/myapp [R,L]


I think you want:

RewriteCond %{QUERY_STRING} p=10001
RewriteRule ^/f$ /myapp [R,L]

The prefix /apex is already a part of the context-path and should be
removed from the URL patterns being matched. If you want to redirect
to
another web application, you need a fully-qualified redirect like
this:

RewriteCond %{QUERY_STRING} p=10001
RewriteRule ^/f$ https://www.google.com/ [R,L]

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to