Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
query
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
web-et-numerique-internet
data.grandlyon.com
web-portal
components
proxies
query
Commits
32707d0d
Commit
32707d0d
authored
5 years ago
by
FORESTIER Fabien
Browse files
Options
Downloads
Patches
Plain Diff
Fixing import problems
parent
9870c16f
No related branches found
No related tags found
1 merge request
!7
Remodele this service
Pipeline
#5043
passed
5 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
index.js
+8
-4
8 additions, 4 deletions
index.js
routes/map.routes.js
+1
-0
1 addition, 0 deletions
routes/map.routes.js
with
9 additions
and
4 deletions
index.js
+
8
−
4
View file @
32707d0d
...
@@ -4,6 +4,7 @@ const port = 9000;
...
@@ -4,6 +4,7 @@ const port = 9000;
const
httpProxy
=
require
(
'
http-proxy
'
);
const
httpProxy
=
require
(
'
http-proxy
'
);
const
cookieParser
=
require
(
'
cookie-parser
'
);
const
cookieParser
=
require
(
'
cookie-parser
'
);
const
printError
=
require
(
'
./helpers/logs.helpers.js
'
).
printError
;
const
printError
=
require
(
'
./helpers/logs.helpers.js
'
).
printError
;
const
printLog
=
require
(
'
./helpers/logs.helpers.js
'
).
printLog
;
// Parse the request headers in order to populate req.cookies
// Parse the request headers in order to populate req.cookies
app
.
use
(
cookieParser
());
app
.
use
(
cookieParser
());
...
@@ -44,7 +45,8 @@ const IGNProxy = httpProxy.createProxyServer({
...
@@ -44,7 +45,8 @@ const IGNProxy = httpProxy.createProxyServer({
if
(
req
.
socket
.
destroyed
&&
err
.
code
===
'
ECONNRESET
'
)
{
if
(
req
.
socket
.
destroyed
&&
err
.
code
===
'
ECONNRESET
'
)
{
req
.
_proxyReq
.
abort
();
req
.
_proxyReq
.
abort
();
}
}
return
console
.
log
(
`ING proxy error, req.socket.destroyed:
${
req
.
socket
.
destroyed
}
,
${
err
}
`
);
printError
(
`ING proxy error, req.socket.destroyed:
${
req
.
socket
.
destroyed
}
,
${
err
}
`
);
return
;
});
});
const
AuthenticatedProxy
=
httpProxy
.
createProxyServer
({
const
AuthenticatedProxy
=
httpProxy
.
createProxyServer
({
...
@@ -59,7 +61,8 @@ const AuthenticatedProxy = httpProxy.createProxyServer({
...
@@ -59,7 +61,8 @@ const AuthenticatedProxy = httpProxy.createProxyServer({
if
(
req
.
socket
.
destroyed
&&
err
.
code
===
'
ECONNRESET
'
)
{
if
(
req
.
socket
.
destroyed
&&
err
.
code
===
'
ECONNRESET
'
)
{
req
.
_proxyReq
.
abort
();
req
.
_proxyReq
.
abort
();
}
}
return
printError
(
`Authenticated proxy error, req.socket.destroyed:
${
req
.
socket
.
destroyed
}
,
${
err
}
`
);
printError
(
`Authenticated proxy error, req.socket.destroyed:
${
req
.
socket
.
destroyed
}
,
${
err
}
`
);
return
;
});
});
var
UnauthenticatedProxy
=
httpProxy
.
createProxyServer
({
var
UnauthenticatedProxy
=
httpProxy
.
createProxyServer
({
...
@@ -73,7 +76,8 @@ var UnauthenticatedProxy = httpProxy.createProxyServer({
...
@@ -73,7 +76,8 @@ var UnauthenticatedProxy = httpProxy.createProxyServer({
if
(
req
.
socket
.
destroyed
&&
err
.
code
===
'
ECONNRESET
'
)
{
if
(
req
.
socket
.
destroyed
&&
err
.
code
===
'
ECONNRESET
'
)
{
req
.
_proxyReq
.
abort
();
req
.
_proxyReq
.
abort
();
}
}
return
printError
(
`Unauthenticated proxy Error, req.socket.destroyed:
${
req
.
socket
.
destroyed
}
,
${
err
}
`
);
printError
(
`Unauthenticated proxy Error, req.socket.destroyed:
${
req
.
socket
.
destroyed
}
,
${
err
}
`
);
return
;
});
});
app
.
locals
.
proxies
=
{
app
.
locals
.
proxies
=
{
...
@@ -86,4 +90,4 @@ app.locals.proxies = {
...
@@ -86,4 +90,4 @@ app.locals.proxies = {
app
.
use
(
require
(
'
./routes/index.js
'
));
app
.
use
(
require
(
'
./routes/index.js
'
));
// STARTING SERVER
// STARTING SERVER
app
.
listen
(
port
,
()
=>
printError
(
`Proxy listening on port:
${
port
}
`
));
app
.
listen
(
port
,
()
=>
printLog
(
'
index.js
'
,
`Proxy listening on port:
${
port
}
`
));
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
routes/map.routes.js
+
1
−
0
View file @
32707d0d
...
@@ -2,6 +2,7 @@ const router = require('express').Router();
...
@@ -2,6 +2,7 @@ const router = require('express').Router();
const
getRedisValue
=
require
(
'
../helpers/redis.helpers.js
'
).
getRedisValue
;
const
getRedisValue
=
require
(
'
../helpers/redis.helpers.js
'
).
getRedisValue
;
const
setRedisValue
=
require
(
'
../helpers/redis.helpers.js
'
).
setRedisValue
;
const
setRedisValue
=
require
(
'
../helpers/redis.helpers.js
'
).
setRedisValue
;
const
getDatasetInfoFromES
=
require
(
'
../helpers/elasticsearch.helpers.js
'
).
getDatasetInfoFromES
;
const
getDatasetInfoFromES
=
require
(
'
../helpers/elasticsearch.helpers.js
'
).
getDatasetInfoFromES
;
const
printError
=
require
(
'
../helpers/logs.helpers.js
'
).
printError
;
router
.
get
(
'
/ign
'
,
(
req
,
res
,
next
)
=>
{
router
.
get
(
'
/ign
'
,
(
req
,
res
,
next
)
=>
{
req
.
headers
[
'
referer
'
]
=
'
grandlyon.com
'
;
req
.
headers
[
'
referer
'
]
=
'
grandlyon.com
'
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment