I have a problem with the appgini application deployed in the azure web app + application gateway. I sometimes got http error 502. I am also getting the re-direction to the original url (xxx.azurewebsite.net) after login. I suspect the 502 error probably due to configuration that is not end-to-end SSL (https://example.com -> http://xxx.azurewebsite.net)
I want to address the issues or redirect after login first.
By default, the web app will have a default domain name xxx.azurewebsites.net.
My setup will be:
custom domain (example.com) -> application gateway -> backend pool (xxx.azurewebsite.net).
I can access to example.com but after login in, the page is redirected to xxx.azurewebsite.net.
I checked the phpinfo, the server_name and http_host are defaulted to xxx.azurewebiste.net.
Moreover, I found the function application_url() in admin/incFunction.php also depend on http_host and server_name.
My idea is to change to $host = config('host') instead in application_url() function.
However I am unsure whether there are php environment variables such as http_host and Server_Name in other appgini files.
Is this the proper way to have custom domain setup up via the routing using application gateway with app service?
Does anyone have any experience on hosting in azure with application gateway and app service?
Azure application gateway + App service (Deployment)
Re: Azure application gateway + App service (Deployment)
Since you also sent me this question via the support form, I'll post my reply here in case anyone faces the same issue.
The issue you're experiencing is that your application gateway is changing the
First, enable
Then create a
This will set the
The issue you're experiencing is that your application gateway is changing the
HTTP_HOST
header as it passes through, which is a common behavior for load balancers and reverse proxies. The HTTP_X_ORIGINAL_HOST
is likely a custom header added by your gateway to preserve the original host.You can Use Apache's mod_rewrite
module to set the HTTP_HOST
header to the value of the HTTP_X_ORIGINAL_HOST
header.First, enable
mod_rewrite
and mod_headers
if they're not already enabled by running the following command via a terminal shell on your server:Code: Select all
sudo a2enmod rewrite
sudo a2enmod headers
sudo systemctl restart apache2
.htaccess
file in the folder containing your AppGini app, and add the following to it:Code: Select all
RewriteEngine On
RewriteCond %{HTTP:X-Original-Host} (.+)
RewriteRule . - [E=HTTP_HOST:%1]
Header set Host %{HTTP_HOST}e env=HTTP_HOST
HTTP_HOST
environment variable to the value of the HTTP_X_ORIGINAL_HOST
header, then set the Host header to this value.
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
- Need personalized consulting on your specific app and customizations? Book an online call with me here.