2023-08-12 17:08:06 +02:00
|
|
|
const axios = require('axios');
|
|
|
|
const middleware = require('./_common/middleware');
|
|
|
|
|
|
|
|
const handler = async (url) => {
|
|
|
|
const fullUrl = url.startsWith('http') ? url : `http://${url}`;
|
|
|
|
|
|
|
|
try {
|
|
|
|
const response = await axios.get(fullUrl);
|
|
|
|
const headers = response.headers;
|
|
|
|
return {
|
2023-09-14 04:29:58 +02:00
|
|
|
strictTransportPolicy: headers['strict-transport-security'] ? true : false,
|
2023-08-12 17:08:06 +02:00
|
|
|
xFrameOptions: headers['x-frame-options'] ? true : false,
|
|
|
|
xContentTypeOptions: headers['x-content-type-options'] ? true : false,
|
|
|
|
xXSSProtection: headers['x-xss-protection'] ? true : false,
|
|
|
|
contentSecurityPolicy: headers['content-security-policy'] ? true : false,
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
return {
|
|
|
|
statusCode: 500,
|
|
|
|
body: JSON.stringify({ error: error.message }),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-09-03 13:27:04 +02:00
|
|
|
module.exports = middleware(handler);
|
|
|
|
module.exports.handler = middleware(handler);
|