Apache 2.4 (Ubuntu) - allow only POST requests to specific url and disable web access for all except particular IP

Viewed 121

I have Graphql on ubuntu server with apache 2.4. I need to block visitors who would try open a particular page URL in browser, e.g. domain.com/db/grapqhl except for a particular IP (which will be my personal IP, let's say 1.1.1.1) and to allow only POST requests from the other server's IP (let's say 2.2.2.2).

I tried writing the following .htaccess file

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/db/graphql$ [NC]

RewriteRule ^.*$ - [F,L]

But the url is still accessible from browser for anyone.

Can you tell me how to properly set such conditional rule?

Any better suggestion is welcome. Thanks

0 Answers
Related