hmm... I had similar problem, but with FCGI This solved my problem: $self->hook( before_dispatch => sub { my $self = shift; $self->req->url->base( Mojo::URL->new(q{http://your-domain.com/}) );
> Is it possible to genarete correct redirections to '/someurl' instead of > '/cgi-bin/...'?
> -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To post to this group, send email to mojolicious@googlegroups.com. > To unsubscribe from this group, send email to mojolicious+unsubscribe@** > googlegroups.com <mojolicious%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at http://groups.google.com/** > group/mojolicious?hl=en <http://groups.google.com/group/mojolicious?hl=en> > .
I use the following variant (and does not require the website to be hardcoded).
$self->hook( before_dispatch => sub { my $self = shift; my $uri = $self->req->env->{SCRIPT_URI}; $self->req->url->base(Mojo::URL->new($uri)) if $uri; });
> hmm... I had similar problem, but with FCGI > This solved my problem: > $self->hook( before_dispatch => sub { > my $self = shift; > $self->req->url->base( Mojo::URL->new(q{http://your-domain.com/}) ); > });
> > Is it possible to genarete correct redirections to '/someurl' instead of > > '/cgi-bin/...'?
> > -- > > You received this message because you are subscribed to the Google Groups > > "Mojolicious" group. > > To post to this group, send email to mojolicious@googlegroups.com. > > To unsubscribe from this group, send email to mojolicious+unsubscribe@** > > googlegroups.com <mojolicious%2Bunsubscribe@googlegroups.com>. > > For more options, visit this group at http://groups.google.com/** > > group/mojolicious?hl=en <http://groups.google.com/group/mojolicious?hl=en> > > .
> I use the following variant (and does not require the website to be > hardcoded).
> $self->hook( before_dispatch => sub { > my $self = shift; > my $uri = $self->req->env->{SCRIPT_URI}; > $self->req->url->base(Mojo::URL->new($uri)) if $uri; > });
> cheers > tobi
> Today Anton Ukolov wrote:
> > Hello.
> > hmm... I had similar problem, but with FCGI > > This solved my problem: > > $self->hook( before_dispatch => sub { > > my $self = shift; > > $self->req->url->base( Mojo::URL->new(q{http://your-domain.com/}) ); > > });
> > > Is it possible to genarete correct redirections to '/someurl' instead > of > > > '/cgi-bin/...'?
> > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Mojolicious" group. > > > To post to this group, send email to mojolicious@googlegroups.com. > > > To unsubscribe from this group, send email to mojolicious+unsubscribe@ > ** > > > googlegroups.com <mojolicious%2Bunsubscribe@googlegroups.com>. > > > For more options, visit this group at http://groups.google.com/** > > > group/mojolicious?hl=en < > http://groups.google.com/group/mojolicious?hl=en> > > > .
> -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To post to this group, send email to mojolicious@googlegroups.com. > To unsubscribe from this group, send email to > mojolicious+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/mojolicious?hl=en.
We sad CGI/FCGI people like to hide the name of our script from the user. Makeing the appropriate URLs work is quite simple using mod_rewrite in apache.
But since you are using SCRIPT_NAME in Mojo/Message/Request.pm to figure out the base url, you are calling our bluff, and if Mojo is asked to create an url the name of the script pops back up.
mod_rewrite provieds a SCRIPT_URI environment contains a "sanitized" version of that information, so that the name of the script remains hidden.
obviously SCRIPT_URI may not exist, so one has to tread carefully here ...
Today Sebastian Riedel wrote: > > mod_rewrite provieds a SCRIPT_URI environment contains a > > "sanitized" version of that information, so that the name of > > the > > script remains hidden.
> > obviously SCRIPT_URI may not exist, so one has to tread > > carefully > > here ...
> I wonder if these mod_rewrite tests are incorrect, they were > provided by a third party and i just made them pass.
he is not looking at SCRIPT_URI which is realy central in this matter as far as I see it, since it points to the 'script' and does not include PATH_INFO ... whereas REQUEST_URI includes PATH_INFO ... (one could be built from the other, though).
> he is not looking at SCRIPT_URI which is realy central in this > matter as far as I see it, since it points to the 'script' and does > not include PATH_INFO ... whereas REQUEST_URI includes PATH_INFO > ... (one could be built from the other, though).
> if Mojo made any use of SCRIPT_URI that is ...
The question is if the current behavior is right or wrong. I would accept patches if it was proven to be wrong.
Today Sebastian Riedel wrote: > > he is not looking at SCRIPT_URI which is realy central in this > > matter as far as I see it, since it points to the 'script' and does > > not include PATH_INFO ... whereas REQUEST_URI includes PATH_INFO > > ... (one could be built from the other, though).
> > if Mojo made any use of SCRIPT_URI that is ...
> The question is if the current behavior is right or wrong. > I would accept patches if it was proven to be wrong.
In the absence of SCRIPT_URI I would say the behaviour is correct. If SCRIPT_URI is present, then there is room for improvement, as Mojo is actually exposing internal information of the web server (the name of the script) where this could be prevented.
> In the absence of SCRIPT_URI I would say the behaviour is correct. > If SCRIPT_URI is present, then there is room for improvement, as > Mojo is actually exposing internal information of the web server > (the name of the script) where this could be prevented.
> but a proof ... difficult :-)
Ok, then they are at least incomplete, i'll remove them for now.
and the example of testing a Mojolicious::Lite app. It's not clear if
this is a completely seperate script which needs to be run, or if it's
a fragment to be put into @@ t/test.pl in the __DATA__ section.
I even found the following blog entry, which looks good, but doesn't
answer the question either.
>>>>> "John" == John Stoffel <j...@stoffel.org> writes:
>>>>> "John" == John Stoffel <j...@stoffel.org> writes:
John> __DATA__;
John> @@ t/test.pl
John> Duh, I'm a moron. I needs to be:
John> @@ t/test.t
John> duh duh duh... At least now it runs a test, even though I'm still
John> failing. Baby steps... baby steps. :]
And I'm still a moron. I had a t/test.t file still around in the same
directory as my test ::Lite app. So it looks like while I can include
static files into Mojolicious::Lite apps, I can't include the test
stuff.
That's ok I guess, I was just trying to get a clarification on how to
do tests properly, since I should move in that direction.
It's been pretty silent here, I must be very boring to read. *grin*