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

Livewire URL not function #15444

Open
2 tasks done
Dustin-Moon opened this issue Sep 3, 2024 · 9 comments
Open
2 tasks done

Livewire URL not function #15444

Dustin-Moon opened this issue Sep 3, 2024 · 9 comments
Assignees

Comments

@Dustin-Moon
Copy link

Dustin-Moon commented Sep 3, 2024

Debug mode

Describe the bug

I have Snipe-it inside of a subdirectory. I have followed the subdirectory steps (https://snipe-it.readme.io/docs/subdirectories#add-the-livewire-config-variable), and I'm having unusual behavior still with livewire. I have snipe-it at (C:\inetpub\wwwroot\support\snipe-it) and have it where when I go to (http://examplesitename/support/snipeit) I am able to access the public page. But when importing I am met with 404 errors. I have (LIVEWIRE_URL_PREFIX=/support/snipeit) and the htaccess file too, and I am still getting the 404 errors.

But when I got to (http://examplesitename/support/snipe-it/public/import) I can import and delete imports with no problem. Weirdly enough it POST 200 from (http://examplesitename/support/snipeit/livewire/update) instead of the directory link that I was on. Not sure if I am missing something here.

Reproduction steps

  1. Host Snipe-it in subdirectory on IIS server
  2. Complete proper subdirectory setup
  3. Have Livewire 404'ing you on Virtual Directory link.
  4. Go to directory link to public folder then import rather than through your Virtual Directory.
  5. Successfully import, but its from your virtual directory link despite being on the directory link.

Expected behavior

Import from Virtual Directory/Application site link rather than directory site link.

Screenshots

Screenshot 2024-09-03 151314
Screenshot 2024-09-03 151333

Snipe-IT Version

7.0.11

Operating System

Windows

Web Server

IIS

PHP Version

8.2.15

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

# --------------------------------------------
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------
APP_ENV=production
APP_DEBUG=false
APP_KEY=REDACTED
APP_URL=**http://examplesitename/support/snipeit**
APP_TIMEZONE='UTC'
APP_LOCALE='en-US'
MAX_RESULTS=500

# --------------------------------------------
# REQUIRED: UPLOADED FILE STORAGE SETTINGS
# --------------------------------------------
PRIVATE_FILESYSTEM_DISK=local
PUBLIC_FILESYSTEM_DISK=local_public

#PRIVATE_FILESYSTEM_DISK=s3_private
#PUBLIC_FILESYSTEM_DISK=s3_public


# --------------------------------------------
# REQUIRED: DATABASE SETTINGS
# --------------------------------------------
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=REDACTED
DB_USERNAME=REDACTED
DB_PASSWORD=REDACTED
DB_PREFIX=null
DB_DUMP_PATH='C:\\PROGRA~2\\MySQL\\MYSQLS~1.7\\bin'
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci
DB_SANITIZE_BY_DEFAULT=false


# --------------------------------------------
# OPTIONAL: SSL DATABASE SETTINGS
# --------------------------------------------
DB_SSL=false
DB_SSL_IS_PAAS=false
DB_SSL_KEY_PATH=null
DB_SSL_CERT_PATH=null
DB_SSL_CA_PATH=null
DB_SSL_CIPHER=null
DB_SSL_VERIFY_SERVER=null

# --------------------------------------------
# REQUIRED: OUTGOING MAIL SERVER SETTINGS
# --------------------------------------------
MAIL_MAILER=smtp
MAIL_HOST=email-smtp.us-west-2.amazonaws.com
MAIL_PORT=587
MAIL_USERNAME=YOURUSERNAME
MAIL_PASSWORD=YOURPASSWORD
MAIL_FROM_ADDR=you@example.com
MAIL_FROM_NAME='Snipe-IT'
MAIL_REPLYTO_ADDR=you@example.com
MAIL_REPLYTO_NAME='Snipe-IT'
MAIL_AUTO_EMBED_METHOD='attachment'
MAIL_TLS_VERIFY_PEER=true

# MAIL_ENCRYPTION is no longer supported. SymfonyMailer will use tls if it's
# advertised, and won't if it's not. If you want to use your mail server's IP but it's failing
# because of certificate errors, set MAIL_TLS_VERIFY_PEER-true

# --------------------------------------------
# REQUIRED: IMAGE LIBRARY
# This should be gd or imagick
# --------------------------------------------
IMAGE_LIB=gd


# --------------------------------------------
# OPTIONAL: BACKUP SETTINGS
# --------------------------------------------
MAIL_BACKUP_NOTIFICATION_DRIVER=null
MAIL_BACKUP_NOTIFICATION_ADDRESS=null
BACKUP_ENV=true
ALLOW_BACKUP_DELETE=false
ALLOW_DATA_PURGE=false

# --------------------------------------------
# OPTIONAL: SESSION SETTINGS
# --------------------------------------------
SESSION_DRIVER=file
SESSION_LIFETIME=12000
EXPIRE_ON_CLOSE=false
ENCRYPT=false
COOKIE_NAME=snipeit_session
PASSPORT_COOKIE_NAME='snipeit_passport_token'
COOKIE_DOMAIN=null
SECURE_COOKIES=false
API_TOKEN_EXPIRATION_YEARS=15
BS_TABLE_STORAGE=cookieStorage
BS_TABLE_DEEPLINK=true

# --------------------------------------------
# OPTIONAL: SECURITY HEADER SETTINGS
# --------------------------------------------
APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1
ALLOW_IFRAMING=false
REFERRER_POLICY=same-origin
ENABLE_CSP=false
ADDITIONAL_CSP_URLS=null
CORS_ALLOWED_ORIGINS=null
ENABLE_HSTS=false

# --------------------------------------------
# OPTIONAL: CACHE SETTINGS
# --------------------------------------------
CACHE_DRIVER=file
QUEUE_DRIVER=sync
CACHE_PREFIX=snipeit

# --------------------------------------------
# OPTIONAL: REDIS SETTINGS
# --------------------------------------------
REDIS_HOST=null
REDIS_PASSWORD=null
REDIS_PORT=null

# --------------------------------------------
# OPTIONAL: MEMCACHED SETTINGS
# --------------------------------------------
MEMCACHED_HOST=null
MEMCACHED_PORT=null

# --------------------------------------------
# OPTIONAL: PUBLIC S3 Settings
# --------------------------------------------
PUBLIC_AWS_SECRET_ACCESS_KEY=null
PUBLIC_AWS_ACCESS_KEY_ID=null
PUBLIC_AWS_DEFAULT_REGION=null
PUBLIC_AWS_BUCKET=null
PUBLIC_AWS_URL=null
PUBLIC_AWS_BUCKET_ROOT=null

# --------------------------------------------
# OPTIONAL: PRIVATE S3 Settings
# --------------------------------------------
PRIVATE_AWS_ACCESS_KEY_ID=null
PRIVATE_AWS_SECRET_ACCESS_KEY=null
PRIVATE_AWS_DEFAULT_REGION=null
PRIVATE_AWS_BUCKET=null
PRIVATE_AWS_URL=null
PRIVATE_AWS_BUCKET_ROOT=null

# --------------------------------------------
# OPTIONAL: AWS Settings
# --------------------------------------------
AWS_ACCESS_KEY_ID=null
AWS_SECRET_ACCESS_KEY=null
AWS_DEFAULT_REGION=null

# --------------------------------------------
# OPTIONAL: LOGIN THROTTLING
# --------------------------------------------
LOGIN_MAX_ATTEMPTS=5
LOGIN_LOCKOUT_DURATION=60
LOGIN_AUTOCOMPLETE=false

# --------------------------------------------
# OPTIONAL: FORGOTTEN PASSWORD SETTINGS
# --------------------------------------------
RESET_PASSWORD_LINK_EXPIRES=15
PASSWORD_CONFIRM_TIMEOUT=10800
PASSWORD_RESET_MAX_ATTEMPTS_PER_MIN=50

# --------------------------------------------
# OPTIONAL: MISC
# --------------------------------------------
LOG_CHANNEL=single
LOG_MAX_DAYS=10
APP_LOCKED=false
APP_CIPHER=AES-256-CBC
APP_FORCE_TLS=false
APP_ALLOW_INSECURE_HOSTS=false
GOOGLE_MAPS_API=
LDAP_MEM_LIM=500M
LDAP_TIME_LIM=600
IMPORT_TIME_LIMIT=600
IMPORT_MEMORY_LIMIT=500M
REPORT_TIME_LIMIT=12000
REQUIRE_SAML=false
API_THROTTLE_PER_MINUTE=120
CSV_ESCAPE_FORMULAS=true
LIVEWIRE_URL_PREFIX=/support/snipeit

# --------------------------------------------
# OPTIONAL: HASHING
# --------------------------------------------
HASHING_DRIVER='bcrypt'
BCRYPT_ROUNDS=10
ARGON_MEMORY=1024
ARGON_THREADS=2
ARGON_TIME=2

# --------------------------------------------
# OPTIONAL: SCIM
# --------------------------------------------
SCIM_TRACE=false
SCIM_STANDARDS_COMPLIANCE=false
Copy link

welcome bot commented Sep 3, 2024

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@Dustin-Moon
Copy link
Author

I went into the LivewireSerivceProvider.php and changed "config('livewire.url_prefix') to the prefix I wanted in the Update Route and it started working. I am assuming there is a problem with the communication. Not sure how the directory link worked though.

@marcusmoore
Copy link
Collaborator

Hi @Dustin-Moon, I'm also confused about how it worked by going directly to /support/snipe-it/public/import...

I opened the PR that introduced that config option and was addressing another reported issue importing but that user was running apache. I wonder if IIS is doing something different here?

@Dustin-Moon
Copy link
Author

Hi @Dustin-Moon, I'm also confused about how it worked by going directly to /support/snipe-it/public/import...

I opened the PR that introduced that config option and was addressing another reported issue importing but that user was running apache. I wonder if IIS is doing something different here?

Don't get me wrong here, I very well could have done something wrong in the installation or one of my files is running weirdly on IIS. I am the new guy at work so the internal IIS site that we are hosting has been on the same computer for 10 years or so. God knows what has been installed or altered on the IIS server.

@marcusmoore
Copy link
Collaborator

I went into the LivewireSerivceProvider.php and changed "config('livewire.url_prefix') to the prefix I wanted in the Update Route and it started working. I am assuming there is a problem with the communication. Not sure how the directory link worked though.

@Dustin-Moon can you explain the change that worked here? Am I understanding it right?

- return Route::post('/' . config('livewire.url_prefix') . '/livewire/update', $handle);
+ return Route::post('/support/snipeit/livewire/update', $handle);

@Dustin-Moon
Copy link
Author

I went into the LivewireSerivceProvider.php and changed "config('livewire.url_prefix') to the prefix I wanted in the Update Route and it started working. I am assuming there is a problem with the communication. Not sure how the directory link worked though.

@Dustin-Moon can you explain the change that worked here? Am I understanding it right?

- return Route::post('/' . config('livewire.url_prefix') . '/livewire/update', $handle);
+ return Route::post('/support/snipeit/livewire/update', $handle);

image
Sort of, I just repalced the "config('livewire.url_prefix')" and left the rest the same. I thought maybe I had some permissions wrong so maybe it couldn't access the file or the .env somewhere along the way. Checked all permissions and still had the same result.

@marcusmoore
Copy link
Collaborator

That is strange since the result of hardcoding it like you did and the existing config('livewire.url_prefix') would be the same as long as your .env has LIVEWIRE_URL_PREFIX=/support/snipeit which you mentioned setting...

You added the **s around the LIVEWIRE_URL_PREFIX=/support/snipeit line in your original "additional context" to attempt to bold it right? That isn't actually in your .env?

@Dustin-Moon
Copy link
Author

That is strange since the result of hardcoding it like you did and the existing config('livewire.url_prefix') would be the same as long as your .env has LIVEWIRE_URL_PREFIX=/support/snipeit which you mentioned setting...

You added the **s around the LIVEWIRE_URL_PREFIX=/support/snipeit line in your original "additional context" to attempt to bold it right? That isn't actually in your .env?

Yes, I was trying to make the line bold for visual purposes in the post.

@marcusmoore
Copy link
Collaborator

It looks like there are a few upstream mentions of this issue or similar issues. I'm going to drop them here for future reference:

I'll do a little more digging and hopefully submit a fix to Livewire itself.

(It's interesting that swapping out the config() call worked. I'm still not sure how.)

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

No branches or pull requests

2 participants