#failed to fetch

1 messages ยท Page 1 of 1 (latest)

green stump
#

my frontend runs on nginx and it makes requests to backend, running on spring boot server. Backend and Frontend run on remote linux server. none of my request work, but they used to work locally. Where is the problem?

mortal sleetBOT
#

<@&1004656351647117403> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question ๐Ÿค–. Maybe it helps! In any case, a human is on the way ๐Ÿ‘. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

ork before. I have checked the network connection and it seems to be fine. What could be the possible reasons for this issue?

There could be several possible reasons for your requests not working. Here are some common issues to consider:

  1. Cross-Origin Resource Sharing (CORS): Check if your backend server has CORS enabled and properly configured to allow requests from your frontend domain. You can do this by inspecting the response headers of your backend API requests.

  2. Firewall or Security Groups: Ensure that there are no firewall rules or security groups blocking the communication between your frontend and backend servers. Check if the necessary ports (e.g., 80 for HTTP, 443 for HTTPS) are open for communication.

  3. DNS or IP Address Changes: Verify that the DNS records or IP addresses of your frontend and backend servers have not changed unexpectedly. If they have changed, update the configurations accordingly.

  4. Server Configuration Changes: Review any recent changes made to the server configurations, such as Nginx or Spring Boot settings, that might affect the communication between frontend and backend.

  5. SSL/TLS Certificates: If you are using HTTPS, ensure that your SSL/TLS certificates are valid and properly configured on both frontend and backend servers.

  6. Logging and Error Handling: Check the logs of both frontend and backend applications for any error messages or exceptions that might provide insights into what went wrong during the request process.

  7. Network Connectivity Issues: Despite checking network connection, there might still be intermittent connectivity issues between your frontend and backend servers due to network problems or infrastructure-related factors.

It is recommended to investigate each of these possibilities systematically to identify the root cause of the issue with your requests not working on your frontend application connected to a remote Spring Boot backend server running on Nginx.

mortal sleetBOT
#

To configure Nginx to make requests to a backend on the same remote server, you can follow these steps:

  1. Install Nginx: If you haven't already, install Nginx on your remote server. The installation process may vary depending on your operating system.

  2. Configure the backend: Set up your backend application or service that you want Nginx to proxy requests to. Ensure that the backend is running and accessible on a specific port (e.g., localhost:8000).

  3. Open the Nginx configuration file: Locate the Nginx configuration file, typically named nginx.conf, which is usually located in the /etc/nginx/ directory.

  4. Edit the configuration file: Open the nginx.conf file in a text editor and locate the http block.

  5. Add a new location block: Inside the http block, add a new location block to define how Nginx should handle requests for your backend. For example:

location /backend {
    proxy_pass http://localhost:8000;
}

In this example, any request made to /backend will be forwarded to http://localhost:8000.

  1. Save and close the configuration file.

  2. Test and reload Nginx: Before applying changes, test the configuration for syntax errors by running nginx -t. If there are no errors, reload Nginx by running sudo service nginx reload or sudo systemctl reload nginx.

  3. Test the setup: Send a request to your server using the defined location path (e.g., http://your-server-ip/backend). Nginx should forward this request to your backend application/service running on port 8000.

Make sure to replace localhost with your actual server IP or hostname if necessary.

Note that these instructions assume a basic setup and may need adjustments based on your specific requirements and environment.

mortal sleetBOT
#

@green stump

Your question has been closed due to inactivity.

If it was not resolved yet, feel free to just post a message below
to reopen it, or create a new thread.

Note that usually the reason for nobody calling back is that your
question may have been not well asked and hence no one felt confident
enough answering.

When you reopen the thread, try to use your time to improve the quality
of the question by elaborating, providing details, context, all relevant code
snippets, any errors you are getting, concrete examples and perhaps also some
screenshots. Share your attempt, explain the expected results and compare
them to the current results.

Also try to make the information easily accessible by sharing code
or assignment descriptions directly on Discord, not behind a link or
PDF-file; provide some guidance for long code snippets and ensure
the code is well formatted and has syntax highlighting. Kindly read through
https://stackoverflow.com/help/how-to-ask for more.

With enough info, someone knows the answer for sure ๐Ÿ‘

green stump
#

help me

abstract holly
#

So these are requests going from your local machine to one of those servers, I would say the nginx one, and failing

#

Pick the specific request url and investigate why it failed

#

Is it present in the nginx?

#

Something is initiating those requests, so your first request probably reached the server, I would guess one to index.html, bu the rest does not

#

I would first look if those are going to the same address

#

That is best I can do on such a limited information

green stump
green stump
green stump
green stump
fiery tree
#

can you share the headers request from your web browser pls ?

#

and check your console too

abstract holly
#

Screenshot of the whole request would be nice, there should be indication of why it happened

#

I would use tracert on that url, see where it stops

mortal sleetBOT
#

@green stump

Your question has been closed due to inactivity.

If it was not resolved yet, feel free to just post a message below
to reopen it, or create a new thread.

Note that usually the reason for nobody calling back is that your
question may have been not well asked and hence no one felt confident
enough answering.

When you reopen the thread, try to use your time to improve the quality
of the question by elaborating, providing details, context, all relevant code
snippets, any errors you are getting, concrete examples and perhaps also some
screenshots. Share your attempt, explain the expected results and compare
them to the current results.

Also try to make the information easily accessible by sharing code
or assignment descriptions directly on Discord, not behind a link or
PDF-file; provide some guidance for long code snippets and ensure
the code is well formatted and has syntax highlighting. Kindly read through
https://stackoverflow.com/help/how-to-ask for more.

With enough info, someone knows the answer for sure ๐Ÿ‘

green stump
north inlet
#

your saying they run on remote , yet your pasting a localhost

#

Backend and Frontend run on remote linux server

green stump
north inlet
#

loaclhost is the same pc

green stump
#

because my logic was: they run on remote machine. so they are locally located

green stump
north inlet
#

localhost can only connect to itself, if u need another machine u need the IP

#

get the ip for the remote machine and adjust your url

#

( and do not ask the adress, its your network ๐Ÿ˜‰ )

fiery tree
#

Hey there

green stump
fiery tree
#

In your frontend

#

Get the location.hostname

green stump
fiery tree
#

It's an object inside the DOM

green stump
#

it will show my domain

fiery tree
#

You dnt need to show

#

Just use it in ur frontend code

#

Instead of "localhost"

#

When the app in remote it will take the hostname where it's running

green stump
fiery tree
#

Yes

green stump
#

OMG

#

this sounds ultra cool

#

let me try

fiery tree
#

๐Ÿ‘

green stump
#

DAAAAMN

#

THANK YOU SOOOOOOOOO MUCH

north inlet
#

nice ๐Ÿ™‚ now remember that localhost adress never leaves the pc itself

green stump
#

๐ŸคŸ

mortal sleetBOT
#

To run a Java application 24/7 on a remote server, you can follow these steps:

  1. Choose a remote server: Select a reliable hosting provider or cloud service that offers virtual private servers (VPS) or dedicated servers.

  2. Set up the server: Provision the server by installing the necessary operating system (e.g., Linux) and configuring it with required software packages, such as Java Development Kit (JDK), web server (e.g., Apache Tomcat), or application server (e.g., WildFly).

  3. Transfer your Java application: Upload your Java application files to the remote server using secure file transfer protocols like SCP or SFTP.

  4. Configure firewall and security settings: Ensure that the necessary ports are open in the server's firewall to allow incoming connections to your Java application. Additionally, configure any security measures like SSL certificates if required.

  5. Start the Java application: Use SSH to connect to the remote server and navigate to the directory where your Java application is stored. Use command-line tools like java or javac to compile and run your Java application.

mortal sleetBOT
# mortal sleet To run a Java application 24/7 on a remote server, you can follow these steps: ...
  1. Run as a background process: To keep your Java application running continuously, you can use tools like nohup or screen in Linux to run it as a background process even after you disconnect from SSH.

  2. Monitor and manage the application: Set up monitoring tools or log aggregators to track your application's performance, logs, and errors remotely. You may also consider using process managers like systemd, supervisor, or containerization technologies like Docker for better management of your Java application.

  3. Automate restarts and updates: Create scripts or use tools like cron jobs to automatically restart your Java application in case of crashes or system reboots. Additionally, automate updates by setting up version control systems (e.g., Git) and continuous integration/continuous deployment (CI/CD) pipelines.

  4. Ensure high availability: Consider setting up load balancing or clustering techniques to distribute the workload across multiple servers for high availability and fault tolerance.

  5. Regular maintenance and backups: Perform regular maintenance tasks like applying security patches, optimizing performance, and taking backups of your Java application and its associated data to prevent data loss.

Remember to consult the documentation of your specific hosting provider or cloud service for any additional steps or recommendations they may have for running Java applications on their platforms.

#

To use nohup with Java apps on a remote server, you can follow these steps:

  1. Connect to the remote server using SSH or any other remote access method.

  2. Navigate to the directory where your Java application is located.

  3. Run the following command to start your Java application with nohup:

    nohup java -jar your_app.jar &
    

    Replace your_app.jar with the actual name of your Java application JAR file.

  4. Press Enter to execute the command. The nohup command will detach the process from the current terminal session and prevent it from being terminated when you close the SSH connection.

  5. You can now safely close the SSH connection without stopping the Java application.

  6. To check if your Java application is running, you can use tools like ps or jps. For example:

    ps aux | grep java
    

    This command will list all running processes containing "java" in their names.

  7. To stop the Java application, you need to find its process ID (PID) using ps or jps, and then use the kill command to terminate it. For example:

    kill <PID>
    

    Replace <PID> with the actual process ID of your Java application.

Note: Make sure that you have appropriate permissions to run commands and access files on the remote server.

green stump
#

GUYS

#

i was looking at wrong window @north inlet @fiery tree

#

it did not work, I am dumb + blind

north inlet
#

oh it does work, read again

#

its finding your page, but its requesting a http<S> ๐Ÿ˜‰

green stump
green stump
north inlet
#

try the last

green stump
north inlet
#

cant help on the other solution, maybe gpt has got a solution in its spybase

green stump
north inlet
#

yeah cant help on the other solution, gpt should have something in its spybase that can help

green stump