Skip to content
Discussion options

You must be logged in to vote

@an-tao thank you for your confirmation so if we have to use filter, middleware, I share this code for everyone who wants to create quickly filters for this needs:

Put your port in custom_config part of drogon config.json

#pragma once
#include <drogon/HttpFilter.h>
#include <drogon/HttpRequest.h>
#include <drogon/HttpResponse.h>
#include <drogon/utils/FunctionTraits.h>
#include <drogon/HttpAppFramework.h>
#include <json/value.h>
#include <drogon/drogon.h>
#include <stdexcept>

template <typename ConfigTag>
class NamedPortFilter : public drogon::HttpFilter<NamedPortFilter<ConfigTag>>
{
public:
    NamedPortFilter()
    {
        static bool initialized = false;
        static uint16_t s_po…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by an-tao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants