Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
522 views
in Technique[技术] by (71.8m points)

apache2 - Trick PHP running behind mod_php and change host and protocol

I'm migrating legacy apps to docker and I need to "trick" php into thinking that it runs on the exact same environment as it used before.

Basically, the app used to run on an apache2 with mod_php and the PHP code does something somewhere that says "If you've been called with HTTP, set the link for the images to http."

My docker image is now accessible locally with http only. But I would like to still fake PHP into thinking that it has been accessed with HTTPS.

I suppose that Apache should rewrite the $_SERVER['HTTPS'] variable but I can't find in the documentation how I could do that.

Here is my current configuration for my app:

<VirtualHost *:8080>
     DocumentRoot "/var/www/app"

     <Directory /var/www/app>
         Require all granted
         Order allow,deny
         Allow from all
         Options Indexes FollowSymLinks
         AllowOverride All
     </Directory>
</VirtualHost>
question from:https://stackoverflow.com/questions/65886245/trick-php-running-behind-mod-php-and-change-host-and-protocol

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...