Keep It Simple, Stupid | |
PerlMonks |
Dancer2 getting a wrong request uriby PeterKaagman (Beadle) |
on Sep 27, 2024 at 08:32 UTC ( [id://11161965]=perlquestion: print w/replies, xml ) | Need Help?? |
PeterKaagman has asked for the wisdom of the Perl Monks concerning the following question: Hi there I know... I know... this is problably more an Apache question than Perl. But since it does involve Dancer2 I hope one of you has some experience with this. So this is my problem: I've been doing a lot of work on Azure. using LWP to do the Graph requests. Usually just cli/backend scripting, which works just fine. But Dancer2 gets me into trouble. Azure, like other oAuth API's, needs a callback URI to accept an authentication attempt. This works just fine during development: doing port forwarding to the development host. In this case Azure gets a callback URI like http://localhost/azuread/callback The problems start when going to production. Azure no longer receives a callback URI which can work, it should get something like https://somesite/azuread/callback, but "somesite" is replaced by the servers IP. I found the callback uri is composed of some variables, one of them being "base". This variable is by default initialized using the request URI, or can be set in the config. So I would be able to set a correct base by putting it in the config, but I'd rather have the default method of using the request URI which comes from Apache (in my case) I'm using an Apache2 vhost with a fcgid setup, some rewrite rules "forward" the request to the dispatch.fcgi. I found a deployment guide for Dancer2 apps and am using a modified version of the fastcgi setup. I could not find an easy way to get mod_fastcgi on my host, but could get mod_fcgid from the Ubuntu repro, I adapted the vhost for mod_fcgid. And I guess something goes wrong there. This is the vhost.conf: <VirtualHost *:80> ServerName somesite.somehost.nl DocumentRoot /var/www/somesite/public Redirect permanent / https://somesite.somehost.nl </VirtualHost> <VirtualHost *:443> ServerName somesite.somehost.nl DocumentRoot /var/www/somesite/public <Directory /var/www/somesite/public> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch #AddHandler fastcgi-script .fcgi AddHandler fcgid-script .fcgi Require all granted </Directory> ErrorLog /var/log/apache2/somesite/error_log CustomLog /var/log/apache2/somesite/access_log common RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /dispatch.fcgi$1 QSA,L Include cert/wildcard.conf </VirtualHost> I suspect the Rewrite setting to be at fault. I did find settings for mod_proxy to infuence the request uri, but I'm not using mod_proxy as far as I know Any thoughts? Peter
Back to
Seekers of Perl Wisdom
|
|