I'm trying to build an automation tool and hit the below url using axios.
import Axios from 'axios';
import https from 'https'
const crypto = await import('node:crypto');
const AxPortal = Axios.create({
withCredentials: true,
timeout: 100 * 1000, // 100 Seconds
headers: {
'Accept': `*/*`,
'Accept-Encoding': `gzip, deflate, br`,
},
httpsAgent: new https.Agent({
rejectUnauthorized: false,
keepAlive: true,
// secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT,
}),
});
try {
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://ahmedabadcity.gov.in/AMCWEBMODULE/PTAX/FrmTENE_PEC_Details.aspx',
headers: {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"accept-language": "en-GB,en;q=0.9",
"cache-control": "no-cache",
"content-type": "application/x-www-form-urlencoded",
"pragma": "no-cache",
"sec-ch-ua": "\"Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"115\", \"Chromium\";v=\"115\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"macOS\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-origin",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1",
"cookie": "IC=New_Portal-114; IC=New_Portal-114; ASP.NET_SessionId=intkr2s1fq3boisbk5euosub",
"Referer": "https://ahmedabadcity.gov.in/AMCWEBMODULE/PTAX/FrmTENE_PEC_Details.aspx",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
data: '__EVENTTARGET=ctl00%24ContentPlaceHolder1%24btnSearch&__EVENTARGUMENT=&__VIEWSTATE=%2FwEPDwUJOTM1NDc5NjAxD2QWAmYPDxYCHgxDaGVja1JlZnJlc2hkZGRkznBbvMGAVh0thuYS8qDrIRZGx59bhzOCypMaMhwHS%2F0%3D&__VIEWSTATEGENERATOR=866B1294&__EVENTVALIDATION=%2FwEdAAqzVdjcSZ6LdZ39M8DiBIgWTISMQzzysGHOJKfvpBax745MW6XMaFjzT9nUdsIknovSEwfOn6alsRzJy8wv1jf1vPli9vWGCGOvCtfFF2dKevXg5240PLXNY%2BeR7zMctTxlkr0BlKlqSn8ZtGvyeRqI2qFniAsD%2BUGyUd6UqbTrDXu2p7I4HFdVOythwxBf%2BZRXBDNB8ZAvxIUtf6ibcdVA%2BSKvH%2BHLvolUAqGprZxKRQZTFGJ8JvyTsrRcq2IwfLo%3D&ctl00%24ContentPlaceHolder1%24txtSEARCHNO=01020711500001V'
};
const resp = await AxPortal.request(config)
console.log(resp.data)
} catch (error) {
console.log(error)
}
The error i'm encountering is "SSL routines:final_renegotiate:unsafe legacy renegotiation disabled"
If I add secure options, the request is successful, but the output html data is not as expected.
If anyone wants to try how the api works and what should be the actual response
visit
URL -> https://ahmedabadcity.gov.in/AMCWEBMODULE/PTAX/FrmTENE_PEC_Details.aspx
and Enter tenement No 01020711500001V