Search

Is there any way to add headers to a page?

in the front end? html headers? yes, via xslt. there is an funny and usefull extension for meta data at pages.

metadata at pages

for http headers are several other things made, like the http caching example

information about this can be found here.

froontendoutputpostgenerate would be a candidate.

If you need HTTP response headers, you might try the HTTP Response Header Mappings extension.

For the life of me I cannot get your extension to work :(

I installed it correctly on Symphony 2.3.3. It built out some headers and I added a couple. I changed the page type to no avail.

###### HTTP-RESPONSE-HEADER-MAPPINGS ######
'http-response-header-mappings' => array(
  'allow-headers' => 'Access-Control-Allow-Headers: X-Auth-Token',
  'allow-origin' => 'Access-Control-Allow-Origin: *',
  '503' => 'HTTP/1.1 503 Service Unavailable',
  'ra1h' => 'Retry-After: 3600',
  'ra1d' => 'Retry-After: 86400',
  'ra1w' => 'Retry-After: 604800',
  'xml' => 'Content-Type: text/xml; charset=utf-8',
  'txt' => 'Content-Type: text/plain; charset=utf-8',
  'js' => 'Content-Type: application/x-javascript; charset=utf-8',
  'json' => 'Content-Type: application/json; charset=utf-8',
  'css' => 'Content-Type: text/css; charset=utf-8',
  'csv' => 'Content-Type: text/comma-separated-values; charset=utf-16',
  'xls' => 'Content-Type: application/msexcel',
  'rss' => 'Content-Type: application/rss+xml',
  'text' => 'Content-Type: text/plain',
),
########

I swear that it works! Do you have a test URL for me to check the headers? (I use Rested or the command line to do this—both do this much better than my browsers.)

Tested this in many different ways for over an hour to no avail.

###### HTTP-RESPONSE-HEADER-MAPPINGS ######
'http-response-header-mappings' => array(
  'allowheaders' => 'Access-Control-Allow-Headers: X-Auth-Token',
  'alloworigin' => 'Access-Control-Allow-Origin: *',
  '503' => 'HTTP/1.1 503 Service Unavailable',
  'ra1h' => 'Retry-After: 3600',
  'ra1d' => 'Retry-After: 86400',
  'ra1w' => 'Retry-After: 604800',
  'xml' => 'Content-Type: text/xml; charset=utf-8',
  'txt' => 'Content-Type: text/plain; charset=utf-8',
  'js' => 'Content-Type: application/x-javascript; charset=utf-8',
  'json' => 'Content-Type: application/json; charset=utf-8',
  'css' => 'Content-Type: text/css; charset=utf-8',
  'csv' => 'Content-Type: text/comma-separated-values; charset=utf-16',
  'xls' => 'Content-Type: application/msexcel',
  'rss' => 'Content-Type: application/rss+xml',
  'text' => 'Content-Type: text/plain',
  'test' => 'Doesnt work'
),
########

Can you prove that in a Symphony install of 2.3.3 you can set a page to have allowheaders and alloworigin and show me a screenshot? I wish I could just throw a header in there with ease instead of all this config, which unfortunately is not working.

Does it require the index page type?

As with all of my experiences, the headers are only present when LOGGED IN to the Symphony back end. Once I log out, the optional headers go away.

No and no.

No, it doesn't require the index page type.

No, it does not depend on the visitor being logged. In my test above the Rested app was not logged in to Symphony.

Your expires header is completely different as well in the examples. Could it be that you are using some other extension that interferes with the Symphony process?

[EDIT]: Even more headers are different. It must be another extension (or hack).

Try running

curl https://www.infowrap.com/en/api/json/verticals/ -v

Current state ..

Output from runscope

###### HTTP-RESPONSE-HEADER-MAPPINGS ######
'http-response-header-mappings' => array(
  'allowheaders' => 'Access-Control-Allow-Headers: X-Auth-Token',
  'alloworigin' => 'Access-Control-Allow-Origin: *',
  '503' => 'HTTP/1.1 503 Service Unavailable',
  'ra1h' => 'Retry-After: 3600',
  'ra1d' => 'Retry-After: 86400',
  'ra1w' => 'Retry-After: 604800',
  'xml' => 'Content-Type: text/xml; charset=utf-8',
  'txt' => 'Content-Type: text/plain; charset=utf-8',
  'js' => 'Content-Type: application/x-javascript; charset=utf-8',
  'json' => 'Content-Type: application/json; charset=utf-8',
  'css' => 'Content-Type: text/css; charset=utf-8',
  'csv' => 'Content-Type: text/comma-separated-values; charset=utf-16',
  'xls' => 'Content-Type: application/msexcel',
  'rss' => 'Content-Type: application/rss+xml',
  'text' => 'Content-Type: text/plain',
),
########

That's what I get:

* About to connect() to www.infowrap.com port 443 (#0)
* Trying 184.169.131.129...
* connected
* Connected to www.infowrap.com (184.169.131.129) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112)
* Closing connection #0
* curl: (35) error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112)

I'm not sure what you're showing me, because those don't look like headers .. ?

Is there a way for me to manually add it somehow? Try a request thru something like runscope.com to https://www.infowrap.com/en/api/json/verticals/

I am still getting ..

Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, PUT, POST, PATCH, DELETE, OPTIONS, HEAD
Access-Control-Allow-Origin: *
Cache-Control: public
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html
Date: Thu, 09 Jan 2014 18:18:51 GMT
Expires: Fri, 10 Jan 2014 17:52:31 GMT
Last-Modified: Thu, 09 Jan 2014 17:52:31 +0000
Pragma: no-cache
Runscope-Message-Id: 27eeb848-eea5-4c35-86f7-2cf219d77081
Server: gunicorn/0.17.1
Set-Cookie: PHPSESSID=vl2lh0rmd8830c0mnku38k2m66; expires=Thu, 23-Jan-2014 18:18:51 GMT; path=/en; domain=infowrap.com; HttpOnly
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Powered-By: PHP/5.3.10-1ubuntu3.9

I'd really like to just have the allowheaders part work Access-Control-Allow-Headers: X-Auth-Token. For some reason this header gets stripped or was never present. Is there anything I can do to debug?

This might sound really stupid, but have you tried re-enabling the extension? The extension itself is so ridiculously simple the only thing I can think of is that the delegate is not fired at all.

If that doesn't work either I'd be happy to take a look. Just send me an email at huib@[username].com

Uninstalled and reinstalled to no avail.

@into: What I tried to show you was that connecting was unsuccessful using curl https://www.infowrap.com/en/api/json/verticals/ -v. Never mind.

From what I have seen, some other extension (or hacked code) is interfering with Symphony's "native" headers (and page building process). If you please do what I did in order to help you — use a Symphony 2.3.3 default installation plus my extension — you will see that the extension works like a charm. I am 100 percent sure that the problem is somewhere else.

There is no hack code, as I don't work with PHP.

The extensions are

As I said above:

If you please do what I did in order to help you — use a Symphony 2.3.3 default installation plus my extension — you will see that the extension works like a charm. I am 100 percent sure that the problem is somewhere else.

Do it, and you will see that this is not a problem of my extension.

There is no hack code, as I don't work with PHP.

If you use so many extensions, you will have to learn how to debug issues like this yourself. Otherwise your last resort is to find someone who wants to take a look at your installation.

BTW: My first guess is CacheLite. You might disable it and see what happens.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details