I would like to use mod_Rewrite and so on in Apache to handle requests that are supposed to go to different servers internally.

Asked 2 years ago, Updated 2 years ago, 43 views

CentOS+Apache configures the following domains:

Server1 virtualhost
http://www.test.com/
https://new-sslhost.com/

Server 2 virtualost https://sslhost.com

Currently, the following index.html contains the following description:
http://www.test.com/index.html
<a href="https://sslhost.com/"><img src=https://sslhost.com/image.jpg></a>

This is used by Apache mod_Rewrite, etc.

when http://test.com/index.html is displayed I want to rewrite "img src=https://sslhost.com/image.jpg" to "img src=https://new-sslhost.com/image.jpg".
When you click the link, the address bar displays https://sslhost.com while
Is it actually possible to display https://new-sslhost.com

?

apache

2022-09-29 22:21

1 Answers

When you click on the link, the address bar displays https://sslhost.com and
Is it actually possible to display https://new-sslhost.com?

If https://sslhost.com appears in the address bar, the browser will have direct access to Server 2, so you can't do anything with unrelated Server 1.If you can do that easily, it will be used for phishing scams.

Of course, you can do that if you do something other than Server1.

  • Include https://sslhost.com in the client hosts file
  • https://sslhsot.comCreate a proxy to send to Server 1 and configure it as a client
  • Set the reverse proxy to Server 2 to send access to Server 1

The key to both methods is to make changes over legitimate communication routes.

When http://test.com/index.html is displayed, I want to rewrite "img src=https://sslhost.com/image.jpg" to "img src=https://new-sslhost.com/image.jpg".

This is possible, but mod_rewrite is only a module that internally rewrites the URL of the request and does not have the ability to modify the contents of the response.I think mod_substitude can be used instead.

Absorbs the difference between production and development environments with mod_substitude - PSI Labs


2022-09-29 22:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.