$self->redirect_to('/someurl');
generates:
/cgi-bin/script/myapp/someurl
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 mojol...@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.
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/}) );
> });
>
> Try to put it to 'startup' method.
>
> 2011/11/8 s...@bykov.odessa.ua <s...@bykov.odessa.ua>
>
> > Hello. I have a little question
> > Mojolicious works as CGI script (using apache mod rewrite in .htaccess)
> >
> > $self->redirect_to('/someurl')**;
> > generates:
> > /cgi-bin/script/myapp/someurl
> >
> > 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 mojol...@googlegroups.com.
> > To unsubscribe from this group, send email to mojolicious+unsubscribe@**
> > googlegroups.com <mojolicious%2Bunsu...@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>
> > .
> >
> >
>
>
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch to...@oetiker.ch ++41 62 775 9902 / sb: -9900
To unsubscribe from this group, send email to mojolicious...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
Today sri wrote:
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.
RewriteEngine On
RewriteBase /~oetiker/extopus
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) ep.fcgi/$1 [L]
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 ...
cheers
tobi
> --
> sebastian
mod_rewrite provieds a SCRIPT_URI environment contains a"sanitized" version of that information, so that the name of thescript remains hidden.obviously SCRIPT_URI may not exist, so one has to tread carefullyhere ...
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.
>
> https://github.com/kraih/mojo/blob/master/t/mojo/request_cgi.t#L439
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 ...
cheers
tobi
he is not looking at SCRIPT_URI which is realy central in thismatter as far as I see it, since it points to the 'script' and doesnot 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 ...
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.
but a proof ... difficult :-)
In the absence of SCRIPT_URI I would say the behaviour is correct.If SCRIPT_URI is present, then there is room for improvement, asMojo is actually exposing internal information of the web server(the name of the script) where this could be prevented.but a proof ... difficult :-)