Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Is it possible reject http request OnHttpRequestHeaders #122

Closed
@sp0cket

Description

@sp0cket

I've tried this demo code

func (ctx *httpHeaders) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
	hs, err := proxywasm.GetHttpRequestHeaders()
	token := // get token from header
	if len(token) == 0 {  // token does not exist
		proxywasm.SendHttpResponse(401, [][2]string{
			{"powered-by", "proxy-wasm-go-sdk!!"},
		}, "reject")
	}
	return types.ActionContinue
}

and got error

envoy bug failure: !state_.local_complete_ || status == FilterHeadersStatus::StopIteration. Details: Filters should return FilterHeadersStatus::StopIteration after sending a local reply.
Caught Abort trap: 6, suspect faulting address 0x7fff20307462
Backtrace (use tools/stack_decode.py to get line numbers):
Envoy version: d6a4496e712d7a2335b26e2f76210d5904002c26/1.17.1/Modified/DEBUG/BoringSSL
#0: Envoy::SignalAction::sigHandler() [0x118340bdc]
#1: _sigtramp [0x7fff20379d7d]
#2: [0x0]
#3: abort [0x7fff20288720]
#4: Envoy::Http::FilterManager::decodeHeaders() [0x116a99b0f]
#5: Envoy::Http::FilterManager::decodeHeaders() [0x1169d4dd6]
#6: Envoy::Http::ConnectionManagerImpl::ActiveStream::decodeHeaders() [0x1169d3976]
#7: Envoy::Http::Http1::ServerConnectionImpl::onMessageComplete() [0x116b9d34a]
#8: Envoy::Http::Http1::ConnectionImpl::onMessageCompleteBase() [0x116b9932d]
#9: Envoy::Http::Http1::ConnectionImpl::$_8::operator()() [0x116ba9440]
#10: Envoy::Http::Http1::ConnectionImpl::$_8::__invoke() [0x116b8e2e5]
#11: http_parser_execute [0x1181a2d30]
#12: Envoy::Http::Http1::ConnectionImpl::dispatchSlice() [0x116b93b44]
#13: Envoy::Http::Http1::ConnectionImpl::innerDispatch() [0x116b92306]
#14: Envoy::Http::Http1::ConnectionImpl::dispatch()::$_14::operator()() [0x116be190e]
#15: std::__1::__invoke<>() [0x116be18bb]
#16: std::__1::__invoke_void_return_wrapper<>::__call<>() [0x116be183b]
#17: std::__1::__function::__alloc_func<>::operator()() [0x116be17cb]
#18: std::__1::__function::__func<>::operator()() [0x116be04cd]
#19: std::__1::__function::__value_func<>::operator()() [0x117f3f18b]
#20: std::__1::function<>::operator()() [0x117f02946]
#21: Envoy::Http::Utility::exceptionToStatus() [0x117f02618]
#22: Envoy::Http::Http1::ConnectionImpl::dispatch() [0x116b90e53]
#23: Envoy::Http::Http1::ConnectionImpl::dispatch() [0x116b90f3b]
#24: Envoy::Http::ConnectionManagerImpl::onData() [0x1169c8bf4]
#25: Envoy::Network::FilterManagerImpl::onContinueReading() [0x114e79791]
#26: Envoy::Network::FilterManagerImpl::onRead() [0x114e7a012]
#27: Envoy::Network::ConnectionImpl::onRead() [0x114df6454]
#28: Envoy::Network::ConnectionImpl::onReadReady() [0x114dffdb1]
#29: Envoy::Network::ConnectionImpl::onFileEvent() [0x114dfc3e0]
#30: Envoy::Network::ConnectionImpl::ConnectionImpl()::$_6::operator()() [0x114e409be]
#31: std::__1::__invoke<>() [0x114e40981]
#32: std::__1::__invoke_void_return_wrapper<>::__call<>() [0x114e40922]
#33: std::__1::__function::__alloc_func<>::operator()() [0x114e408d2]
#34: std::__1::__function::__func<>::operator()() [0x114e3f5f3]
#35: std::__1::__function::__value_func<>::operator()() [0x114d0144d]
#36: std::__1::function<>::operator()() [0x114d013ef]
#37: Envoy::Event::DispatcherImpl::createFileEvent()::$_3::operator()() [0x114d013b4]
#38: std::__1::__invoke<>() [0x114d01361]
#39: std::__1::__invoke_void_return_wrapper<>::__call<>() [0x114d01302]
#40: std::__1::__function::__alloc_func<>::operator()() [0x114d012b2]
#41: std::__1::__function::__func<>::operator()() [0x114cffe83]
#42: std::__1::__function::__value_func<>::operator()() [0x114d0144d]
#43: std::__1::function<>::operator()() [0x114d013ef]
#44: Envoy::Event::FileEventImpl::mergeInjectedEventsAndRunCb() [0x114d0b5d5]
#45: Envoy::Event::FileEventImpl::assignEvents()::$_1::operator()() [0x114d0bb83]
#46: Envoy::Event::FileEventImpl::assignEvents()::$_1::__invoke() [0x114d0b786]
#47: event_persist_closure [0x11818f0e5]
#48: event_process_active_single_queue [0x11818e718]
#49: event_process_active [0x118188ee4]
#50: event_base_loop [0x118187dab]
#51: Envoy::Event::LibeventScheduler::run() [0x118077af4]
#52: Envoy::Event::DispatcherImpl::run() [0x114cc820a]
#53: Envoy::Server::WorkerImpl::threadRoutine() [0x114bd43e5]
#54: Envoy::Server::WorkerImpl::start()::$_5::operator()() [0x114c0804c]
#55: std::__1::__invoke<>() [0x114c0800d]
#56: std::__1::__invoke_void_return_wrapper<>::__call<>() [0x114c07fbd]
#57: std::__1::__function::__alloc_func<>::operator()() [0x114c07f8d]
#58: std::__1::__function::__func<>::operator()() [0x114c06cbe]
#59: std::__1::__function::__value_func<>::operator()() [0x10ab1fb55]
#60: std::__1::function<>::operator()() [0x10ab1f925]

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions