Questions tagged [http-header]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
4answers
1k views

Magento2: How to modifiy http header of page?

I am trying to modify HTTP header for current URL. I want to set 410 status if current page header is 404. below code I used but I have created new controller so it always set 410 for that controller ...
3
votes
1answer
5k views

Console showing Error parsing header X-XSS-Protection: 1; mode=block, 1; mode=block:

I don't know what it's means and how to remove this error. it's showing in my chrome console . but not in firefox console.. (index):1 Error parsing header X-XSS-Protection: 1; mode=block, 1; mode=...
3
votes
2answers
123 views

set x-frame-options in custom controller magento2

I have a custom controller with below code. namespace Vendor\Module\Controller\Service; class Login extends \Magento\Framework\App\Action\Action{ protected $_storeManager; protected $_customerFactory;...
2
votes
2answers
3k views

Triggering a 404, 500, 503 error in Magento 2

Is there a standard way in Magento 2 to programmatically trigger an HTTP error state and have the system just deal with it? i.e. is there a standard exception we can throw or global method we can ...
2
votes
1answer
39 views

HOW TO ADD ALTERNATIVE HTTP HEADERS TO MAGENTO 2

I wanna add custom header to the response. l do like this article but it does not work. I guest it about Magento version. I use Magento 2.3
1
vote
1answer
280 views

X-XSS-Protection header gets set twice - override XssProtection.php

I use magento 2 (version 2.3) and cloudFlare. There is an error with http headers: X-XSS-Protection header gets set twice because magento add this and then ClouFlare add again. See this post It's ...
1
vote
1answer
370 views

Error Showing in Console “X-XSS-Protection: 1; mode=block, 1; mode=block: expected semicolon” in Magento2

Error parsing header X-XSS-Protection: 1; mode=block, 1; mode=block: expected semicolon at character position 13. The default protections will be applied. I am using Apache Server. How to resolve it. ...
1
vote
1answer
38 views

How can I include additional headers in every 401 Magento2 response?

How can I include some additional headers every time server needs to send 401 responses? I tried adding it in Magento\Framework\Controller\Result\Json render() method like: if ($response->...
1
vote
0answers
83 views

Improve caching in Magento

I want to protect my site from DoS attacks and I want to change some http headers. At present I have the following headers: Request URL:https://www.mysite.co.uk/ Request Method:GET Status Code:200 ...
0
votes
1answer
1k views

how to set no-cache HTTP headers in controller in magento 2

I have read in Magento 2 Dev Docs for Public content we can set no-cache HTTP headers for Controllers that don’t use layouts(last line in page). Controllers that don’t use layouts should set no-...
0
votes
1answer
632 views

Magento 2.2.5: Warning: Cannot modify header information - headers already sent by [custom_theme registration.php]

I'm developing a custom theme and running into errors. The theme has been tested and working on various servers but, for some reason, since uploading to siteground I get the following error (file ...
0
votes
0answers
28 views

Magento 2 Append HTTP response header using di.xml

I have to change the scope of a file file being served, it would be perfect if could be defined via theme or module. I have tried something like following in di.xml without success: <?xml version=...
0
votes
1answer
361 views

Magento 2 Check if url returns 404

I have ann Array of urls $arr = Array( 'http://magento2.com/url-exist', 'http://magento2.com/url-does-not-exist', 'http://magento2.com/url-does-not-exist', 'http://...