Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cloud/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ func (s *LocalGatewayService) createApiServers() error {
ReadTimeout: time.Second * 1,
IdleTimeout: time.Second * 1,
CloseOnShutdown: true,
ReadBufferSize: 8192,
ReadBufferSize: 64 * 1024, // Set to 64 KB to handle large headers
Handler: s.handleApiHttpRequest(apiName),
Logger: log.New(s.logWriter, fmt.Sprintf("%s: ", lis.Addr().String()), 0),
}
Expand Down
25 changes: 25 additions & 0 deletions pkg/dashboard/frontend/cypress/e2e/api-explorer.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ const expectedEndpoints = [
'my-secret-api-/set-binary-POST',
]

function setLongCookie(name: string, value: string) {
const maxSize = 4000 // Approximate max cookie size (4KB)
const chunks = Math.ceil(value.length / maxSize) // Calculate the number of chunks needed

// Loop through and set each chunk as a separate cookie
for (let i = 0; i < chunks; i++) {
const chunkValue = value.substring(i * maxSize, (i + 1) * maxSize) // Get the current chunk of the value
cy.setCookie(`${name}-${i}`, chunkValue) // Set the chunk as a cookie with the index in the name
}
}

describe('APIs spec', () => {
beforeEach(() => {
cy.viewport('macbook-16')
Expand Down Expand Up @@ -335,4 +346,18 @@ describe('APIs spec', () => {
}
})
})

it('should handle big headers', () => {
setLongCookie('long-header', 'a'.repeat(10000))

cy.intercept('/api/call/**').as('apiCall')

cy.get('[data-rct-item-id="first-api-/all-methods-GET"]').click()

cy.getTestEl('send-api-btn').click()

cy.wait('@apiCall')

cy.getTestEl('response-status', 5000).should('contain.text', 'Status: 200')
})
})