skip to Main Content
const OTP_API = "https://192.168.4.10:8001/api/tatreports/getotp/";
const onNumberCheck = async () => {
    try {
      const response = await axios.get(
        `https://localhost:3005/api/is-user-exist/0${inputNumberValue}`
      );

      console.log(response);
      if (response.status === 200) {
        setIsUserExist(true);
        // Send a notification when status is 200
        notification.success({
          message: ` سلام ${response.data.name}`,
          description:
            "کد احراز هویت برای شما ارسال شد. لطفا آن را وارد نمایید.",
        });
        setLoggedUserName(response.data.name);
        setLoggedUserAccessType(response.data.accessType);

        const otpRespons = await axios.get(`${OTP_API}${inputNumberValue}`);
        if (otpRespons.status === 200) {
          setValidationCode(otpRespons.data);
          console.log(otpRespons.data);
        }else{
          notification.error({
            message: `مشکلی پیش آمده`,
            description: "لطفا ارتباط با سرویس پیامکی را چک کنید و یا با پشتیبانی تماس بگیرید",
          });
        }
      }else if(response.status === 403){
        notification.error({
          message: `این شماره اجازه دسترسی ندارد`,
          description: "لطفا با پشتیبانی تماس بگیرید",
        });
      }
    } catch (error) {
      if (error.response) {
        // The request was made, but the server responded with a status code
        const statusCode = error.response.status;
        console.error(`Request failed with status code: ${statusCode}`);
        notification.error({
          message: `این شماره اجازه دسترسی ندارد`,
          description: "لطفا با پشتیبانی تماس بگیرید222",
        });
      } else if (error.request) {
        notification.error({
          message: `No response received from the server.`,
          description: "لطفا با پشتیبانی تماس بگیرید",
        });
        console.error("");
      } else {
        notification.error({
          message: `Error setting up the request:`,
          description: `${error.message}`,
        });
      }
    }
  };

in this code i get the same, it works when i use http for localhost or my Windows server but when i change it to https i get this error: AxiosError: write EPROTO 483E0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:c:wsdepsopensslopensslsslrecordssl3_record.c:355:

2

Answers


  1. You can try with a domain name using a valid SSL certificate in your server.

    https://DomainName/api/is-user-exist/0${inputNumberValue}

    Login or Signup to reply.
  2. You cannot access Local IP Addresses with https://

    You have to use http:// for development. Then when you deploy it to any web server there you can use https after installing SSL.

    like: https://example.com/
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search