snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Various issues when using an install in a subdirectory

Open tbradsha opened this issue 9 years ago • 9 comments

Expected Behavior (or desired behavior if a feature request)

Navigation and creation of models, etc., should work fine in mydomain.local/inventory/ (after proper setup of Apache, etc.).


Actual Behavior

Site tries to load from mydomain.local/ instead of mydomain.local/inventory/ Apache config is correct, and most of the site works fine.


Please confirm you have done the following before posting your bug report:


Provide answers to these questions:

  • Fresh install
  • Snipe-IT v4.0.4 build 1 (geca5a05)
  • PHP 5.6.28
  • MySQL 5.7.15
  • Windows Server 2012 R2 + Apache 2.4 (XAMPP)
  • Manual installation

Most of the issues occur when an AJAX request was made to the API. For example, if I'm on this page:

mydomain.local/inventory/hardware/create

and I try to create a new model, it tries to make a call to /api/v1/models. I was able to resolve this by hard-coding the subfolder in several files. For example, I edited snipeit_modals.js and changed the following line:

url: "/api/v1/" + model + "s",

to this:

url: "/inventory/api/v1/" + model + "s",

In all, I hard-coded the following files with my subdirectory URL:

\inventory\resources\assets\js\snipeit_modals.js \inventory\resources\assets\js\components\importer\importer.vue \inventory\resources\assets\js\components\importer\importer-file.vue \inventory\resources\views\importer\import.blade.php \inventory\public\js\dist\all.js \inventory\build\vue.js \inventory\build\vue.js.map

tbradsha avatar Oct 03 '17 17:10 tbradsha

Yea, you are not alone. the subdirectory issues were not there in v3.6.6

Hopefully, it will be resolved within this week.

raakhtar avatar Oct 03 '17 18:10 raakhtar

Please try updating to 4.0.8. Many of these issues should be fixed.

mnemonicly avatar Oct 03 '17 19:10 mnemonicly

Please do not hardcode URLs. You'll just make upgrading later a nightmare for yourself.

snipe avatar Oct 03 '17 20:10 snipe

I know that hardcoding is a bad idea for long-term use, but it was done to demo the product, and I wasn't too worried about starting over :^) I've gone ahead and done a fresh install of 4.0.9, and the issue is still there. The console shows the following:

/api/v1/models Failed to load resource: the server responded with a status of 404 (Not Found)

Whereas it should be looking for /inventory/api/v1/models. Perhaps the only thing that remains to be changed is the reference in all.js (and perhaps snipeit_modals.js). Thanks!

tbradsha avatar Oct 04 '17 14:10 tbradsha

Also exists as #4150

mnemonicly avatar Oct 05 '17 12:10 mnemonicly

fixed in v4.0.10

raakhtar avatar Oct 17 '17 08:10 raakhtar

Still an issue in v4.0.10 for me...the all.js file is still trying to reference /api/v1/models. Changing this to ../api/v1/models works in my case, though this seems a hackish fix.

tbradsha avatar Oct 17 '17 17:10 tbradsha

@tbradsha that change is already in develop/master. It might be hackish, but short of building in a complicated routing system, it makes the most sense.

snipe avatar Oct 17 '17 17:10 snipe

Great, sounds good!

tbradsha avatar Oct 18 '17 12:10 tbradsha