@@ -30,6 +30,8 @@ app.use(session({
30
30
app . use ( '*' , ( req , res , next ) => {
31
31
console . log ( '*****************************' ) ;
32
32
console . log ( '*** New request ***' ) ;
33
+ console . log ( `*** Client IP: ${ req . headers [ 'x-forwarded-for' ] || req . socket . remoteAddress } ***` ) ;
34
+ console . log ( `*** Client domain: ${ req . hostname } :${ req . socket . localPort } ***` ) ;
33
35
console . log ( `*** Received url: ${ req . url } ***` ) ;
34
36
console . log ( `*** Requested url: ${ req . query ?. url ?? req . originalUrl } ***` ) ;
35
37
@@ -58,9 +60,14 @@ app.get(entryEndpoint, async (req, res) => {
58
60
getAndSendData ( res , targetUrl ) ;
59
61
} ) ;
60
62
63
+ app . get ( '/robots.txt' , ( _req , res ) => {
64
+ res . type ( 'text/plain' ) ;
65
+ res . send ( 'User-agent: *\nDisallow: /' ) ;
66
+ } ) ;
67
+
61
68
app . get ( '/' , ( _req , res ) => {
62
69
const welcomeMsg = "Bienvenue sur smart-proxy ! \nAjouter le paramètre '/proxy?url=http...' à la route courante en completant l'URL" ;
63
- const welcomeMsg_EN = "Welcome to smart-proxy! \nAdd the query parameter '/proxy?url=http...' to the current route by completing the URL" ;
70
+ const welcomeMsg_EN = "Welcome to smart-proxy! \nAdd the query parameter '/proxy?url=http...' to the current route by completing the URL" ;
64
71
res . status ( 200 ) . send ( welcomeMsg . concat ( ' /\n\n' ) . concat ( welcomeMsg_EN ) ) ;
65
72
} ) ;
66
73
@@ -83,7 +90,7 @@ app.listen(port, () => {
83
90
//#region Helpers
84
91
85
92
async function getAndSendData ( res , targetUrl ) {
86
- console . log ( `*** target url: ${ targetUrl } ` ) ;
93
+ console . log ( `*** target url: ${ targetUrl } *** ` ) ;
87
94
console . log ( '*****************************' ) ;
88
95
89
96
try {
0 commit comments