Skip to content

Is there a way to intercept HTTP requests made by Craft and modify the headers? #16126

Closed Answered by brandonkelly
jamesmacwhite asked this question in Q&A
Discussion options

You must be logged in to vote

You can modify the config that Craft uses to create Guzzle (HTTP) clients via config/guzzle.php:

<?php

return [
    'headers' => [
        'User-Agent' => '...',
    ],
];

Looks like it’s not documented (on it), but Feed Me supports setting a clientOptions array on your feed configs from config/feed-me.php, which will get merged into the main Guzzle config:

<?php

return [
    '*' => [
        'clientOptions' => [
            'headers' => [
                'User-Agent' => '...',
            ],
        ],
    ],
];

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jamesmacwhite
Comment options

Answer selected by brandonkelly
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