lobehub / lobe-chat

๐Ÿคฏ Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.53k stars 9.99k forks source link

[Bug] cross origin request block #4230

Open BILAL324 opened 1 month ago

BILAL324 commented 1 month ago

๐Ÿ“ฆ Environment

Docker

๐Ÿ“Œ Version

latest

๐Ÿ’ป Operating System

Ubuntu

๐ŸŒ Browser

Firefox

๐Ÿ› Bug Description

cross origin request block even the request is 200 ok

even that link is accessible

Screenshot from 2024-09-30 19-50-03

๐Ÿ“ท Recurrence Steps

No response

๐Ÿšฆ Expected Behavior

No response

๐Ÿ“ Additional Information

No response

lobehubbot commented 1 month ago

๐Ÿ‘€ @BILAL324

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ ้žๅธธๆ„Ÿ่ฐขๆ‚จๆไบค issueใ€‚ๆˆ‘ไปฌไผšๅฐฝๅฟซ่ฐƒๆŸฅๆญคไบ‹๏ผŒๅนถๅฐฝๅฟซๅ›žๅคๆ‚จใ€‚ ่ฏท็กฎไฟๆ‚จๅทฒ็ปๆไพ›ไบ†ๅฐฝๅฏ่ƒฝๅคš็š„่ƒŒๆ™ฏไฟกๆฏใ€‚

dosubot[bot] commented 1 month ago

To resolve the CORS error for a PUT request to your local server (bilalbucke.localhost:9001) in Docker on Ubuntu using Firefox, you need to ensure that the CORS headers are correctly configured on your server. Based on the provided docker-compose.yml file, it looks like you are using MinIO, which has CORS settings.

You need to configure the CORS settings for MinIO to allow requests from your local server. Here is how you can do it:

  1. Update the MinIO CORS configuration: Ensure that the MINIO_API_CORS_ALLOW_ORIGIN environment variable is set correctly to allow requests from your local server. In your docker-compose.yml, it should look like this:

    minio:
      image: minio/minio
      container_name: lobe-minio
      network_mode: 'service:network-service'
      volumes:
        - './s3_data:/etc/minio/data'
      environment:
        - 'MINIO_ROOT_USER=${MINIO_ROOT_USER}'
        - 'MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}'
        - 'MINIO_API_CORS_ALLOW_ORIGIN=http://bilalbucke.localhost:9001'
      restart: always
      command: >
        server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"
  2. Set up CORS configuration in MinIO: You need to create a CORS configuration file and apply it to your MinIO server. Here is an example of a CORS configuration JSON file (cors.json):

    [
      {
        "AllowedOrigins": ["http://bilalbucke.localhost:9001"],
        "AllowedMethods": ["GET", "PUT", "POST", "DELETE"],
        "AllowedHeaders": ["*"],
        "ExposeHeaders": ["ETag"],
        "MaxAgeSeconds": 3000
      }
    ]
  3. Apply the CORS configuration: Use the MinIO client (mc) to apply the CORS configuration to your MinIO server. First, install the MinIO client if you haven't already:

    wget https://dl.min.io/client/mc/release/linux-amd64/mc
    chmod +x mc
    sudo mv mc /usr/local/bin/

    Then, configure the MinIO client and apply the CORS settings:

    mc alias set myminio http://localhost:${MINIO_PORT} ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD}
    mc admin config set myminio/ api.cors < cors.json

By ensuring that the CORS settings are correctly configured, you should be able to resolve the CORS error for your PUT request [1].

To continue talking to Dosu, mention @dosu.

BILAL324 commented 1 month ago

i did everything the same 200 ok statuscode , but the error is same CORB

arvinxx commented 1 month ago

can you try with another browser ?

BILAL324 commented 1 month ago

sure, just getting back in few minutes

BILAL324 commented 1 month ago

not working

lobehubbot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


not working

BILAL324 commented 1 month ago

i means the uabove all solutions are not working

BrandonStudio commented 1 month ago

Perhaps https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSDidNotSucceed would help