S
S
Sinot2016-01-14 19:06:51
Apache HTTP Server
Sinot, 2016-01-14 19:06:51

How to set up proxying in .htaccess?

Greetings.
There is a hosting with a website ( http://site.org) and a server with an external static IP (2.2.2.2) and a WEB service on a certain port (9999). (Everything in brackets is an example)
I want to proxy this service to the hosting address ( site.org/test) so that JavaScript can work with the WEB service. So that both POST, and GET, and URL, that is, requests " 2.2.2.2/qw?a=1 " and " site.org/test/qw?a=1 " are equivalent.
Actually, there are a lot of questions on the correct redirect on the Internet, I tried:

#Просто редирект работает
RewriteCond %{REQUEST_URL} ^/test/$
RewriteRule ^.*$ https://google.com/? [L]

#А вот так дает ошибку 404
#Object not found!
#The requested URL was not found this server.If you entered the URL manually please check your spelling and try again.
RewriteCond %{REQUEST_URL} ^/test/$
RewriteRule ^.*$ http://2.2.2.2:9999/? [L,P,QSA]

Actually a question in correctness of setup of proxying. There is a possibility of disabling the proxy option in Apache itself at the hosting, but before writing to them I want to get a working setup.
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question