I am also having this issue. I have verified URL rewriting is on and working. AllowOverride All is set.
How do I debug this?

    NuFu

    If you are being redirected back to client portal then url rewriting is not working properly or maybe you put the wrong callback URL.

    Cheers.

    • NuFu replied to this.

      I have the same issue since 1.17 upgrade, according to the hosting provider "AllowOverride All" ist active. what else can cause this issue? are there any detailed logs?

        cross-it

        You will need to check the logs on the server end. Also, it truly sounds like this is not enabled for your site or you put the wrong callback URL.

        Cheers.

        KevinTheJedi So I enabled the rewrite log to try and debug. I see it going through the rules and attempting to rewrite. I just dont know what it is supposed to end up looking like. The only thing I can think of is that my ticket site is in a nested folder. So instead of being at the base domain it is something like https://www.basedomain.com/support .

        The recall back URL is set to https://www.basedomain.com/support/api/auth/oauth2

        The base website is located in "/var/www/basedomain.com/web/"
        The osticket site is located in "/var/www/basedomain.com/web/support"

        Here is the Rewrite log that is happening

        [Fri Oct 14 03:42:38.619496 2022] [rewrite:trace3] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf8d0a0/initial] [perdir /var/www/basedomain.com/web/support/api/] add path info postfix: /var/www/basedomain.com/web/support/api/auth -> /var/www/basedomain.com/web/support/api/auth/oauth2
        [Fri Oct 14 03:42:38.619607 2022] [rewrite:trace3] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf8d0a0/initial] [perdir /var/www/basedomain.com/web/support/api/] strip per-dir prefix: /var/www/basedomain.com/web/support/api/auth/oauth2 -> auth/oauth2
        [Fri Oct 14 03:42:38.619645 2022] [rewrite:trace3] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf8d0a0/initial] [perdir /var/www/basedomain.com/web/support/api/] applying pattern '^(.*)$' to uri 'auth/oauth2'
        [Fri Oct 14 03:42:38.619742 2022] [rewrite:trace4] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf8d0a0/initial] [perdir /var/www/basedomain.com/web/support/api/] RewriteCond: input='/var/www/basedomain.com/web/support/api/auth' pattern='!-f' => matched
        [Fri Oct 14 03:42:38.619919 2022] [rewrite:trace4] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf8d0a0/initial] [perdir /var/www/basedomain.com/web/support/api/] RewriteCond: input='/var/www/basedomain.com/web/support/api/auth' pattern='!-d' => matched
        [Fri Oct 14 03:42:38.619995 2022] [rewrite:trace4] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf8d0a0/initial] [perdir /var/www/basedomain.com/web/support/api/] RewriteCond: input='/support/api/auth/oauth2' pattern='(.*/api)' => matched
        [Fri Oct 14 03:42:38.620140 2022] [rewrite:trace2] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf8d0a0/initial] [perdir /var/www/basedomain.com/web/support/api/] rewrite 'auth/oauth2' -> '/support/api/http.php/auth/oauth2'
        [Fri Oct 14 03:42:38.620182 2022] [rewrite:trace2] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf8d0a0/initial] [perdir /var/www/basedomain.com/web/support/api/] trying to replace context docroot /var/www/basedomain.com/web with context prefix
        [Fri Oct 14 03:42:38.620192 2022] [rewrite:trace1] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf8d0a0/initial] [perdir /var/www/basedomain.com/web/support/api/] internal redirect with /support/api/http.php/auth/oauth2 [INTERNAL REDIRECT]
        [Fri Oct 14 03:42:38.620316 2022] [rewrite:trace3] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf393f0/initial/redir#1] [perdir /var/www/basedomain.com/web/support/api/] add path info postfix: /var/www/basedomain.com/web/support/api/http.php -> /var/www/basedomain.com/web/support/api/http.php/auth/oauth2
        [Fri Oct 14 03:42:38.620333 2022] [rewrite:trace3] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf393f0/initial/redir#1] [perdir /var/www/basedomain.com/web/support/api/] strip per-dir prefix: /var/www/basedomain.com/web/support/api/http.php/auth/oauth2 -> http.php/auth/oauth2
        [Fri Oct 14 03:42:38.620341 2022] [rewrite:trace3] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf393f0/initial/redir#1] [perdir /var/www/basedomain.com/web/support/api/] applying pattern '^(.*)$' to uri 'http.php/auth/oauth2'
        [Fri Oct 14 03:42:38.620355 2022] [rewrite:trace4] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf393f0/initial/redir#1] [perdir /var/www/basedomain.com/web/support/api/] RewriteCond: input='/var/www/basedomain.com/web/support/api/http.php' pattern='!-f' => not-matched
        [Fri Oct 14 03:42:38.620364 2022] [rewrite:trace1] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efcabf393f0/initial/redir#1] [perdir /var/www/basedomain.com/web/support/api/] pass through /var/www/basedomain.com/web/support/api/http.php
        [Fri Oct 14 03:42:38.620436 2022] [rewrite:trace1] [pid 1142856] mod_rewrite.c(483): [client 111.111.111.111:59058] 111.111.111.111 - - [www.basedomain.com/sid#7efcabe2e718][rid#7efca84090a0/subreq] [perdir /var/www/basedomain.com/web/] pass through /var/www/basedomain.com/web/auth

        .htaccess file in /api

        <IfModule mod_rewrite.c>
        
        RewriteEngine On
        
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} (.*/api)
        
        RewriteRule ^(.*)$ %1/http.php/$1 [L]
        
        </IfModule>

        In the vhost config I have

        <Directory /var/www/basedomain.com/web>
                                        # Clear PHP settings of this website
                                        <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                                                        SetHandler None
                                        </FilesMatch>
                                        Options +SymlinksIfOwnerMatch
                                        AllowOverride All
                                                                        Require all granted
                                                        </Directory>

        Any and all help very much Appreciated.

          NuFu

          Do you have a separate Apache config for the support subfolder?

          Cheers.

          • NuFu replied to this.

            Hi,
            I think i got the same error. 404 see in the log.

            Can i copy/paste the result somewhere in the DB? or put the configuration from hand some where?

            Thanks for the help.

            I got a better reply from our provider. They cannot enable AllowOverrides All on our server for security reason.

            @KevinTheJedi Can you tell me which detailed functions osTicket needs?

            At the moment this is configured:
            Options -ExecCGI -FollowSymlinks -Includes +IncludesNoExec -Indexes -Multiviews +SymLinksIfOwnerMatch
            AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch

              KevinTheJedi Thanks for the idea. I contacted my host and have confirmed that URL rewriting is on for this domain and sub domain. I have also confirmed that AllowOverride All is set. The only thing so far that I can think of is that my redirect URL is incorrect. It is currently set to the default which was entered during setup (see screenshot). Can you confirm if this is correct or not? Thanks.

              as an aside, when browsing the files, this directory doesn't exist in this state which I'm assuming the re-direct is all about. Where should it be in order that I can confirm that it actually exists. Thanks again. Sam

                cross-it

                I don’t know what you mean. Please further explain on what you are asking.

                sedwardson

                It appears correct. The path doesn’t physically exist which is why you need URL Rewriting enabled. It will hit api/ folder and use the api/.htaccess file to rewrite the URL appropriately. Maybe your host doesn’t allow .htaccess files to be loaded?

                Cheers.

                  KevinTheJedi Sorry to be a pain, however, i think I'm (you're) getting closer. My .htaccess file consists of the following. Is there anything else that should be in it? This is in the api folder.

                  <IfModule mod_rewrite.c>

                  RewriteEngine On

                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteCond %{REQUEST_URI} (.*/api)

                  RewriteRule .*$ %1/http.php/$1 [L]

                  </IfModule>

                    KevinTheJedi So I do not have a separate Apache config. Just one config for the vhost. I have a WordPress site at the root with Osticket in the sub directory.

                      NuFu

                      Then maybe try adding one specifically for the subfolder with AllowOverride All, restart Apache, and retest.

                      Cheers.

                      KevinTheJedi Thanks for all your help. I asked my host and they spotted that the issue seems to come from the .htaccess rules in the /api folder. The following one:
                      RewriteRule .*$ %1/http.php/$1 [L]
                      Should only be:
                      RewriteRule .*$ %1/http.php/ [L]
                      This resolved my issue, however, I still have issues with emails not fetching or sending but thats for another thread ! thanks for all your help.

                        sedwardson

                        I use Apache and did not need to make any changes other than enabling URL Rewriting. Maybe your host has some weird routing issues or something?

                        Cheers.

                        With the solution of @sedwardson I got redirected to the root site of my osTicket instance but the OAuth has no Token. So not really a solution I guess.

                        @"KevinTheJedi My provider ask which rewriting options are needed since they cannot set "All"