Skip to content

Commit

Permalink
Merge branch 'next' of github.com:SAEON/data-portal into next
Browse files Browse the repository at this point in the history
  • Loading branch information
zachsa committed Sep 16, 2022
2 parents 7db35ef + 3bea89e commit fd07227
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const {
export default (requestDetail, { pathname: originPathname, search }) => {
requestDetail.protocol = protocol

const index = originPathname.match(/(?<=\/elasticsearch\/8.1\/)(.*)$/)[0].replace('/_search', '')
const index = originPathname.match(/(?<=\/elasticsearch\/8.x\/)(.*)$/)[0].replace('/_search', '')
if (!ALLOWED_ES_INDICES.includes(index)) {
throw new Error(`The index "${index}" is not configured as publicly searchable`)
}
Expand All @@ -27,8 +27,8 @@ export default (requestDetail, { pathname: originPathname, search }) => {
port,
path: normalize(
`${destinationPathname}${originPathname
.replace(`/elasticsearch/8.1/${index}/_search`, `${index}/_search${search}`)
.replace(`/elasticsearch/8.1/${index}`, `${index}/_search`)}${search}`
.replace(`/elasticsearch/8.x/${index}/_search`, `${index}/_search${search}`)
.replace(`/elasticsearch/8.x/${index}`, `${index}/_search`)}${search}`
),
}
}
4 changes: 2 additions & 2 deletions src/proxy/src/rules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import csirRule from './_csir.js'
import hstRule from './_hst.js'
import deprecatedElasticsearchRule from './_elasticsearch-deprecated.js'
import elasticsearch714Rule from './_elasticsearch-7.14.js'
import elasticsearch81Rule from './_elasticsearch-8.1.js'
import elasticsearch81Rule from './_elasticsearch-8.x.js'
import saeonGeoServersRule from './_saeon-geoservers.js'
import saeonGeoServerApp04Rule from './_saeon-geoserver-app04.js'
import saeonGeoServerApp04Rule2 from './_saeon-geoserver-app04-2.js'
Expand All @@ -21,7 +21,7 @@ const beforeSendRequest = async requestDetail => {
proxiedRequest = csirRule(requestDetail, url)
} else if (pathname.includes('/hst')) {
proxiedRequest = hstRule(requestDetail, url)
} else if (pathname.includes('/elasticsearch/8.1')) {
} else if (pathname.includes('/elasticsearch/8.x')) {
proxiedRequest = elasticsearch81Rule(requestDetail, url)
} else if (pathname.includes('/elasticsearch/7.14')) {
proxiedRequest = elasticsearch714Rule(requestDetail, url)
Expand Down

0 comments on commit fd07227

Please sign in to comment.