tiredofit / docker-osticket

Dockerized help desk application
MIT License
71 stars 56 forks source link

Additional page not found #46

Open MichaelJumble opened 7 months ago

MichaelJumble commented 7 months ago

Hello,

just start up the container and it works all out of the box. Also need a static page with privacy notes. So I created a new page with Admin Panel >> Manage >> Pages >> Add new Page

Set Name:test, Type: other status:active

After ADD PAGE, i see "Successfully added test"

image

When I perform the Link

image

https://[servername]/pages/test

I catch 404 from ngnix.

image

But I would expect:

image

Im not sure but it looks like an nginx or php rewrite setting.

My settings: using latetest Image here

image

Thanks for any hints.

MichaelJumble commented 7 months ago

First of all:

The nginx config file is missing this entry to rewrite /pages/xxx into pages/index.php/xxx

       location /pages/ {
          try_files $uri $uri/ /pages/index.php?$query_string;
      }

at the top of the nginx_conf/osticket.conf file.

But this did not only solve the problem here.

I found out the Path is not parsed by php. Its empty. Looks like that the apache server set env value "PATH_INFO" and this will not work in nginx.

Dumping the value $_server will post

["PATH_INFO"]=> string(0) ""

Add here a static function in /include/class.osticket.php


  static function get_pages_path_info() {
     $urlArr=parse_url($_SERVER['REQUEST_URI']);
     $output = explode('/',$urlArr["path"]);

  return $output[2];
  }

and switch in /pages/index.php

from $slug = Format::slugify(Osticket::get_path_info());

to $slug = Format::slugify(Osticket::get_pages_path_info());

I'm sure there will be a better solution for this. Later I found this:

https://github.com/osTicket/osTicket/pull/3322/files#diff-b27506b8f359235fc48d6dc627e4fd7e7b6116fe9b5197d90a9b344526172260

But this did not work here.