I have my site which URL is like this: https://test.my.webpage.example

And I need to block a URL similar to: https://test.my.webpage.example/weblogic/someApp/someService

This is for a application in Java, over a WebSphere, that must communicate to a WebLogic. The webserver is behind a firewall on the DMZ. The appserver is on the GRN, as well as the server that has the weblogic.

When any person hit that URL, the expectation is to receive a default error page.

  • What kind of webserver? – covener Apr 3 at 0:59
  • IHS - With Linux. – DevMouse Apr 3 at 16:56

If you're using the WebSphere WebServer Plug-in, you can stop it from being proxied which should result in a webserver 404:

SetEnvIf REQUEST_URI ^/+weblogic/+someApp/+someService$ skipwas=1

Otherwise, if you use mod_proxy, one simple way to return a 404 is with mod_rewrite, in the virtual host or base server config handling the hostname:

RewriteEngine ON
RewriteRule ^/+weblogic/+someApp/+someService - [R=404]

Well, finally did it with a change on httpd.conf, something like:

LoadModule weblogic_module /apps/web-apps/cncboltestenv2/cncboltestenv2_Runtime/testenv2_someapp/conf/lib/mod_wl.so

<IfModule mod_weblogic.c>
        <Location /weblogic/instancia/>
                SecureProxy ON
                WebLogicCluster server01u:80443,server02u:80443
                WLSSLWallet /apps/web-apps/cncboltestenv2/cncboltestenv2_Runtime/testenv2_someapp/keys/Wallet
                DynamicServerList OFF
                pathtrim /weblogic
                SetHandler weblogic-handler

You can use .htaccess to block access to a URL.

Sample 301 redirect Websphere

If you use .htaccess to block the URL:

RewriteEngine On
RewriteRule (^|/)weblogic/someApp/someService(/|$) - [F]

.htaccess sample

  • Not for content that's proxied and doesn't hit the filesystem. – covener Apr 3 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.