hashtopolis / server

Hashtopolis - distributed password cracking with Hashcat
GNU General Public License v3.0
1.42k stars 212 forks source link

[BUG]: APIv2 Frontend Fails to Load assets/config.json for Custom Backend URL #1066

Closed Repsay closed 3 months ago

Repsay commented 3 months ago

Version Information

docker:latest

Hashcat

No response

Description

When hosting the Docker Compose setup on a server other than localhost, I need to change the .env variable for HASHTOPOLIS_BACKEND_URL. After updating this value, the frontend console logs the following:

Using HASHTOPOLIS_BACKEND_URL: http://new_server.intern:8080/api/v2 
Done configuring up Hashtopolis frontend (env=production) at /usr/share/nginx/html/assets/config.json

The content of assets/config.json appears to be correct. However, when attempting to log in on the homepage, the request is still sent to http://localhost:8080/api/v2/auth/token instead of the new server URL.

Steps to Reproduce:

  1. Change the HASHTOPOLIS_BACKEND_URL in the .env file to http://new_server.intern:8080/api/v2.
  2. Deploy the Docker Compose setup on a non-localhost server.
  3. Attempt to log in via the homepage.

Expected Behavior: The login request should be sent to http://new_server.intern:8080/api/v2/auth/token.

Actual Behavior: The login request is sent to http://localhost:8080/api/v2/auth/token.

Additional Information:

Repsay commented 3 months ago

Resolution: The issue was identified as being related to the localStorage in the browser, which retained the old URL (localhost:8080) that was set before the .env changes were applied. This outdated value persisted even after force reloading the page without cache.

Solution: To resolve this issue, you need to manually clear the localStorage in your browser. Here are the steps:

1.  Open your browser’s Developer Tools (usually accessible by pressing F12 or Ctrl+Shift+I).
2.  Navigate to the Application tab.
3.  Under Storage, locate Local Storage.
4.  Select the entry corresponding to your site (e.g., http://new_server.intern:8080).
5.  Manually clear the stored data.

After clearing the localStorage, the frontend should correctly load the updated configuration from assets/config.json, and the login requests should be sent to the new server URL as expected.