Skip to content

Commit

Permalink
Merge pull request #780 from dpc-sdp/bugfix/site-search-basic-auth
Browse files Browse the repository at this point in the history
fix(@dpc-sdp/ripple-tide-search): send app search key on server to fi…
  • Loading branch information
jeffdowdle authored Aug 16, 2023
2 parents 8dfb428 + 636b368 commit 89201db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ripple-tide-search/components/TideSearchPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ const { public: config } = useRuntimeConfig()
const site = await useTideSite()
const apiConnectorOptions = {
...config.tide?.appSearch,
// Omit the search key, we'll add it on the server
engineName: config.tide?.appSearch.engineName,
// The search request is proxied through the API to avoid CORS issues
endpointBase: '/api/tide/app-search'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ export const createAppSearchHandler = async (event: H3Event) => {
pathRewrite: {
'^/api/tide/app-search': ''
},
on: {
proxyReq(proxyReq) {
proxyReq.setHeader(
'Authorization',
`Bearer ${config.tide.appSearch.searchKey}`
)
}
},
logger: logger,
changeOrigin: true
})
Expand Down

0 comments on commit 89201db

Please sign in to comment.