I have a xampp (lampp) running on a linux machine (RHEL9) hosting several applications.
Normally the users access the applications by using the Server IP/appName. All these applications reside inside the /opt/lampp/htdocs directory with different folders for each application.
Now the issue is that i have another https nodejs (localhost:3333) application that i want to run on the same server and be able to access that applicaiton in similar format eg Server IP/app1.
After researching about possible ways to do this, i found out that it can be done using the existing apache server running to host xampp applications.
I created VirtualHost configuration to reverse proxy the /app1 to https://localhost:3333/ using the below configurations
<VirtualHost *:443>
ServerAdmin [email protected]
#added host file entry pointing apps.abc.com to 127.0.0.1
ServerName apps.abc.com
ServerAlias www.apps.abc.com
DocumentRoot /home/<user>/<folder>
SSLEngine on
SSLCertificateFile "/home/<user>/<folder>/cert.pem"
SSLCertificateKeyFile "/home/<user>/<folder>/key.pem"
ProxyPass /app1 https://localhost:3333/
ProxyPassReverse /app1 https://localhost:3333/
<Location "/app1">
ProxyPassReverse "/"
</Location>
ErrorLog "logs/apps.abc.com-error_log"
CustomLog "logs/apps.abc.com-access_log" common
</VirtualHost>
When i add this to the httpd-vhosts file and include that in my main https.conf and restart apache, I am successfully routed to the node app but I face 2 issues:
-
When i click on a button on the page that is supposed to take me to the /login server route, i get 404 Not found error.(This works fine without apache and also works fine if the change the apache route from /app1 to just /). Upon inspecting using devtools, the request is being routed to server-ip/login?
-
All the other applications hosted by XAMPP become unavailbe too and give 404 Not Found error.
This is the code that is executed when the button on the page is clicked
window.location.href = "/login";
And this is how the server handles that request
app.get('/login', passport.authenticate('azuread-openidconnect'));
How can I resolve this?
Anon_1100 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.