If a fetch of /faq yields a log entry of GET "/" then it seems to me like
Apache isn't passing the environment variables.  I don't remember much
about Apache any more, been using Mojolicious as my web servers for close
to five years!  :D

Can you modify your Mojo app code to inspect your environment.  Perhaps use
a hook?  Maybe in before_dispatch
<http://mojolicious.org/perldoc/Mojolicious#before_dispatch>

$c->app->log->info("Env $_: $ENV{$_}") foreach keys %ENV;


You'll need to see PATH_INFO there.  If you do, perhaps let's troubleshoot
your app further; if you don't, focus on Apache maybe?

I don't recall ever running a Mojo app as CGI from Apache, but as you said
according to the Cookbook, it looks like a piece of cake.

Amazing how simple!

$ env PATH_INFO=/ mojo
Content-Length: 21
Content-Type: text/html;charset=UTF-8
Status: 200 OK
Date: Wed, 27 Dec 2017 08:33:12 GMT

Your Mojo is working!


But without that environment, Mojolicious doesn't detect that it's CGI and
runs

$ env mojo
Usage: APPLICATION COMMAND [OPTIONS]

  mojo version
  mojo generate lite_app
  ./myapp.pl daemon -m production -l http://*:8080
  ./myapp.pl get /foo
  ./myapp.pl routes -v

Tip: CGI and PSGI environments can be automatically detected very often and
     work without commands.

Options (for all commands):
  -h, --help          Get more information on a specific command
      --home <path>   Path to home directory of your application, defaults
to
                      the value of MOJO_HOME or auto-detection
  -m, --mode <name>   Operating mode for your application, defaults to the
                      value of MOJO_MODE/PLACK_ENV or "development"

Commands:
 cgi       Start application with CGI
 cpanify   Upload distribution to CPAN
 daemon    Start application with HTTP and WebSocket server
 eval      Run code against application
 generate  Generate files and directories from templates
 get       Perform HTTP request
 inflate   Inflate embedded files to real files
 prefork   Start application with pre-forking HTTP and WebSocket server
 psgi      Start application with PSGI
 replget   Perform HTTP requests in a REPL
 routes    Show available routes
 sendgrid  Sendgrid API
 test      Run tests
 version   Show versions of available modules

See 'APPLICATION help COMMAND' for more information on a specific command.


You can force it

$ env mojo cgi
Status: 200 OK
Content-Length: 21
Content-Type: text/html;charset=UTF-8
Date: Wed, 27 Dec 2017 08:47:54 GMT

Your Mojo is working!


Maybe you should.  Just thinking out loud, but either edit your script and
change it from start_app('PremiumCareerScout') to
start_app('PremiumCareerScout',
'cgi') or perhaps you can modify script/premium_career_scout.pl to be
script/premium_career_scout.pl cgi tho that really seems like a bad idea
because Mojolicious can detect CGI and clearly it isn't because likely
PATH_INFO isn't defined.

Let's see where any of that gets you...  I'll admit I don't really know,
but hoping that helps!

On Tue, Dec 26, 2017 at 3:11 PM, Michael Schmid <[email protected]>
wrote:

> I have found some more strange behaviour.
>
> It doesn't matter which of the mentioned links I click, I see in the
> mojo-log all the time the same message...
>
> Code hier eingeben...[Tue Dec 26 22:08:35 2017] [debug] GET "/"
> [Tue Dec 26 22:08:35 2017] [debug] Routing to controller
> "PremiumCareerScout::Controller::Portal" and action "main"
> [Tue Dec 26 22:08:35 2017] [debug] Rendering template
> "portal/main.html.ep"
> [Tue Dec 26 22:08:35 2017] [debug] Rendering template
> "layouts/portal.html.ep"
> [Tue Dec 26 22:08:35 2017] [debug] Rendering template
> "layouts/navbarV003.html.ep"
> [Tue Dec 26 22:08:35 2017] [debug] Rendering template
> "layouts/leftSideBarV003.html.ep"
> [Tue Dec 26 22:08:35 2017] [debug] Rendering template
> "layouts/rightSideBarV003.html.ep"
> [Tue Dec 26 22:08:35 2017] [debug] 200 OK (0.023922s, 41.803/s)
> [Tue Dec 26 22:08:39 2017] [debug] GET "/"
> [Tue Dec 26 22:08:39 2017] [debug] Routing to controller
> "PremiumCareerScout::Controller::Portal" and action "main"
> [Tue Dec 26 22:08:39 2017] [debug] Rendering template
> "portal/main.html.ep"
> [Tue Dec 26 22:08:39 2017] [debug] Rendering template
> "layouts/portal.html.ep"
> [Tue Dec 26 22:08:39 2017] [debug] Rendering template
> "layouts/navbarV003.html.ep"
> [Tue Dec 26 22:08:39 2017] [debug] Rendering template
> "layouts/leftSideBarV003.html.ep"
> [Tue Dec 26 22:08:39 2017] [debug] Rendering template
> "layouts/rightSideBarV003.html.ep"
> [Tue Dec 26 22:08:39 2017] [debug] 200 OK (0.019665s, 50.852/s)
> [Tue Dec 26 22:08:42 2017] [debug] GET "/"
> [Tue Dec 26 22:08:42 2017] [debug] Routing to controller
> "PremiumCareerScout::Controller::Portal" and action "main"
> [Tue Dec 26 22:08:42 2017] [debug] Rendering template
> "portal/main.html.ep"
> [Tue Dec 26 22:08:42 2017] [debug] Rendering template
> "layouts/portal.html.ep"
> [Tue Dec 26 22:08:42 2017] [debug] Rendering template
> "layouts/navbarV003.html.ep"
> [Tue Dec 26 22:08:42 2017] [debug] Rendering template
> "layouts/leftSideBarV003.html.ep"
> [Tue Dec 26 22:08:42 2017] [debug] Rendering template
> "layouts/rightSideBarV003.html.ep"
> [Tue Dec 26 22:08:42 2017] [debug] 200 OK (0.020633s, 48.466/s)
> [Tue Dec 26 22:08:44 2017] [debug] GET "/"
> [Tue Dec 26 22:08:44 2017] [debug] Routing to controller
> "PremiumCareerScout::Controller::Portal" and action "main"
> [Tue Dec 26 22:08:44 2017] [debug] Rendering template
> "portal/main.html.ep"
> [Tue Dec 26 22:08:44 2017] [debug] Rendering template
> "layouts/portal.html.ep"
> [Tue Dec 26 22:08:44 2017] [debug] Rendering template
> "layouts/navbarV003.html.ep"
> [Tue Dec 26 22:08:44 2017] [debug] Rendering template
> "layouts/leftSideBarV003.html.ep"
> [Tue Dec 26 22:08:44 2017] [debug] Rendering template
> "layouts/rightSideBarV003.html.ep"
> [Tue Dec 26 22:08:44 2017] [debug] 200 OK (0.024079s, 41.530/s)
>
> I clicked different links like /faq, /contacts etc. It doesn't look like
> mojo get the correct routing info..
>
> regards
> Michael
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to