Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install Snipe-it 5.3.8 in sub-directory #10577

Closed
GaneshKandu opened this issue Jan 29, 2022 · 15 comments · Fixed by #10623
Closed

Can't install Snipe-it 5.3.8 in sub-directory #10577

GaneshKandu opened this issue Jan 29, 2022 · 15 comments · Fixed by #10623
Assignees

Comments

@GaneshKandu
Copy link

Snipe-IT Version

5.3.8

Operating System

Linux CentOS

Web Server

Apache

PHP Version

PHP 7.4.25

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Hi,

I am trying to install Snipe-it 5.3.8 in sub-directory Ex. http://mydomain.com/subdirectory/snipeit/public
but Snipe-it looking css, js and images in root http://mydomain.com but they are present at http://mydomain.com/subdirectory/snipeit/public therefore it causing 404 error

Describe the solution you'd like A clear and concise description of what you want to happen.

you can set other files and folder as data directory except public any where in non accessible directory
and public for any where in web accessible

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

No response

Additional context Add any other context or screenshots about the feature request here.

No response

@GaneshKandu
Copy link
Author

@uberbrady you able to reproduce this bug ?

@chrisgraf
Copy link

chrisgraf commented Feb 3, 2022

Same here after an Update via php upgrade.php. It used to work before (I don't know the exact version)

@snipe
Copy link
Owner

snipe commented Feb 3, 2022

Can you both tell me what you have set as your APP_URL in your .env?

@chrisgraf
Copy link

chrisgraf commented Feb 3, 2022

It's APP_URL=https://<domainname>/snipeit for me

@GaneshKandu
Copy link
Author

APP_URL=http://mydomain.com/subdirectory/snipeit/public

@uberbrady
Copy link
Collaborator

public should not be in there.

@GaneshKandu
Copy link
Author

Still not working

@snipe
Copy link
Owner

snipe commented Feb 4, 2022

Thanks for the feedback. We've made it abundantly clear that Snipe-IT does not want to be run in a subdirectory. We're working on fixing the issue here, but at the end of the day, the better answer is: Just Don't If You Can Avoid It.

We'll update this GH issue with our progress - please hang tight.

@chrisgraf
Copy link

I know, but as it worked until now I didn't expect this to break. For us running it on a subdomain is not an option. Thanks a lot for your effort! Is there an easy way to downgrade again in the meantime?

@snipe
Copy link
Owner

snipe commented Feb 4, 2022

We made some changes to how root urls work in order to handle a laravel-level security issue. Brady has been assigned to this issue and I’m confident he’ll get it sorted.

@savornicesei
Copy link

savornicesei commented Feb 5, 2022

I can confirm the issue. As a workaround (since I'm running Snipe-IT in a Bitnami LAMPP env. limited to localhost) I've set
APP_ALLOW_INSECURE_HOSTS=true in .env file, based on the changes made in this commit.

Thanks.

@uberbrady
Copy link
Collaborator

Excellent workaround, @savornicesei - yes, that will at least disable the code that I added until I can get it all sorted out. I can’t believe that I didn’t think of mentioning it earlier, thank you!

It’s tough for me to work on because I don’t have a good test environment for subdirectories right now so I’m kinda struggling.

The test I want to see (with APP_ALLOW_INSECURE_HOSTS unset, of course), is this:

Changing this line:

\URL::forceRootUrl($root_url);

To instead say something like:

\URL::forceRootUrl(config(‘app.url’));

I’m wondering if that makes it work any better?

@savornicesei
Copy link

savornicesei commented Feb 7, 2022

@uberbrady With \URL::forceRootUrl(config('app.url')); and APP_ALLOW_INSECURE_HOSTS=false Snipe-It configured as a subdirectory works fine.

@uberbrady
Copy link
Collaborator

I'll try and get a PR up with this today. Thanks for the troubleshooting help, @savornicesei !

@savornicesei
Copy link

@uberbrady No problem. Glad to help! Let me know if and when you need additional subdirectory testing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants