Skip to content

Commit

Permalink
fix: fix site api call
Browse files Browse the repository at this point in the history
  • Loading branch information
dylankelly committed Jan 29, 2025
1 parent 280c801 commit 0ec3c29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/nuxt-ripple/server/api/tide/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const createPageHandler = async (
const {
public: { isStatic }
} = useRuntimeConfig()

// Set User-Agent for static crawler requests to prevent rate limiting
if (isStatic) {
headers['user-agent'] = 'Quant;'
}
Expand Down
4 changes: 4 additions & 0 deletions packages/nuxt-ripple/server/api/tide/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export const createSiteHandler = async (

const headers = {}

const {
public: { isStatic }
} = useRuntimeConfig()

if (isStatic) {
headers['user-agent'] = 'Quant;'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export const createFilesProxyHandler = async (event: H3Event) => {
on: {
proxyReq(proxyReq) {
proxyReq.setHeader('X-Sdp-Request-Location', 'tide')
// Set User-Agent for static crawler requests to prevent rate limiting
if (config.isStatic) {
proxyReq.setHeader('User-Agent', 'Quant;')
}
},
proxyRes(proxyRes) {
if (proxyRes?.headers) {
Expand Down

0 comments on commit 0ec3c29

Please sign in to comment.