Apache Reverse Proxy erases <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> - sharepoint-2010

this is my first post here.
I've already searched the forum for a related issue, but none of the results seems to solve my issue.
The setup is:
There is a MS Sharepoint 2010 deployed on IIS 7 in an internal customer network. This seems to behave correctly from within the internal network.
To make this service public, I have an apache 2.2 server running on Red Hat EL 6.0 on a DMZ. The apache has a vhost configured as Reverse proxy to allow the conections from outside.
Due to some links problems i found, I had to compile and integrate mod_proxy_html module to parse those Links.
The problem is that I see strange characters when accessing from outside (through the apache). And it is due to the Apache erasing an html meta tag:
From inside the MZ, the html code starts:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html dir="ltr" lang="es-ES">
<head><meta http-equiv="X-UA-Compatible" content="IE=10" /><meta name="GENERATOR" content="Microsoft SharePoint" /><meta http-equiv="Content-type" content="text/html; charset=utf-8" /><meta http-equiv="Expires" content="0" /><meta name="msapplication-TileImage" content="/_layouts/15/images/SharePointMetroAppTile.png" /><meta name="msapplication-TileColor" content="#0072C6" /><title>
However, when accessed from outside, the html code starts:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html dir="ltr" lang="es-ES">
<head><meta http-equiv="X-UA-Compatible" content="IE=10" /><meta name="GENERATOR" content="Microsoft SharePoint" /><meta http-equiv="Expires" content="0" /><meta name="msapplication-TileImage" content="/_layouts/15/images/SharePointMetroAppTile.png" /><meta name="msapplication-TileColor" content="#0072C6" /><title>
Tag missing: meta http-equiv="Content-type" content="text/html; charset=utf-8".
I have already tried adding to my httpd.conf:
AddDefaultCharset utf-8
ProxyHTMLCharsetOut utf-8
ProxyHTMLMeta On
The virtualhost is configured as follows (130.177.97.99 is the IP belonging to the backend):
<VirtualHost bpocenter-hp:5445>
ServerName www.bpocenter-hp.com
SSLProtocol -all +TLSv1
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLEngine on
SSLProxyEngine on
SSLCertificateChainFile /etc/httpd/cert_bpo-hp/intermediate.crt
SSLCertificateKeyFile /etc/httpd/cert_bpo-hp/server.key
SSLCertificateFile /etc/httpd/cert_bpo-hp/server.crt
ProxyHTMLEnable On
SetOutputFilter proxy-html
ProxyHTMLLogVerbose On
ProxyHTMLExtended on
ProxyHTMLMeta On
TransferLog "|/usr/serveis/app/apache/bin/rotatelogs /serveis/logs/bpocenter-hp/access_log 86400"
ErrorLog "|/usr/serveis/app/apache/bin/rotatelogs /serveis/logs/bpocenter-hp/error_log 86400"
ProxyRequests Off
ProxyPass / http://130.177.97.99:8065/ ttl=900 timeout=900 Keepalive=On
ProxyPassReverse / http://130.177.97.99:8065/
RequestHeader unset Accept-Encoding
ProxyHTMLLinks a href
ProxyHTMLLinks area href
ProxyHTMLLinks link href
ProxyHTMLLinks img src longdesc usemap
ProxyHTMLLinks object classid codebase data usemap
ProxyHTMLLinks q cite
ProxyHTMLLinks blockquote cite
ProxyHTMLLinks ins cite
ProxyHTMLLinks del cite
ProxyHTMLLinks form action
ProxyHTMLLinks input src usemap
ProxyHTMLLinks head profile
ProxyHTMLLinks base href
ProxyHTMLLinks script src for
ProxyHTMLLinks iframe src
ProxyHTMLEvents onclick ondblclick onmousedown onmouseup \
onmouseover onmousemove onmouseout onkeypress \
onkeydown onkeyup onfocus onblur onload \
onunload onsubmit onreset onselect onchange
SetOutputFilter proxy-html
ProxyHTMLURLMap http://130.177.97.99:8065 https://www.bpocenter-hp.com:5445
Any help would be appreciated.
Thanks.
Juan

I fixed this by using:
xml2EncDefault utf-8

Related

Difference between GET/POST express Response.redirect

I am trying to redirect a user after authentication from a login service to the resource service. There for, when someone tries to access the main page of my app, I check for the auth token inside a cookie and based on that validation, I serve the html file or redirect to the auth service where I am greeting them with a login/register form.
if(cookie?.auth){
return res.status( 301 ).redirect( `${ protocol }://${ process.env.REDIRECT_AUTH }/login?redirect=${ protocol }://${ hostname }:${ PORT }&session=${ req.sessionID }` );
}
This part works as expected. I get redirected to the endpoint. The question mark appears here. After I enter the credentials, I make a post request to the auth service and if everything goes right, I call the res.redirect(location), the location being the redirect query listed in the link above with some parameters as well.
Here is the snippit:
return res.status( 301 ).redirect( `${ location }?auth=${ token }` as string );
Of course, I am checking if the request query contain the credentials I need. The request actually returns 200, but instead of being redirected to the page, I get the file as a response payload.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
HAASDASD
</body>
</html>
My immediate conclusion was that is about the difference between the GET vs POST method and therefor I get a different result. Is there anyone who stumbled into something similar?

apache 301 redirect can i hide url from message

I have set 301 redirection for certain URL and I don't want this message
is there any way to remove URL from this message or just set custom message.
which is showing in response of curl
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved here.</p>
<hr>
<address>Apache/2.4.29 (Ubuntu) Server at x.x.x.x Port 80</address>
</body></html>
Edit /etc/apache2/conf-available/security.conf and set:
ServerTokens Prod
ServerSignature Off

Vue-cli production build - browser cache problem?

We are building e-commerce, we're using vue on front, and we decided it's the best to follow vue team recommendations, and start new project with vue-cli.
Our problem appears when we are trying to deliver new version to our clients. We are building new application, new files in dist/ folder appears, with new hashes in the name... aaanddd clients still has old version.
That's actually the weirdest part, that browser is somehow caching our code, despite of new hashes O.o
Do anybody had similar problem? And any idea how to solve this?
Assuming this is nothing to with service worker/PWA, the solution could be implemented by returning the front end version by letting the server return the current version of the Vue App everytime.
axiosConfig.js
axios.interceptors.response.use(
(resp) => {
let fe_version = resp.headers['fe-version'] || 'default'
if(fe_version !== localStorage.getItem('fe-version') && resp.config.method == 'get'){
localStorage.setItem('fe-version', fe_version)
window.location.reload() // For new version, simply reload on any get
}
return Promise.resolve(resp)
},
)
Full Article here: https://blog.francium.tech/vue-js-cache-not-getting-cleared-in-production-on-deploy-656fcc5a85fe
A possible problem could be that the browser is caching the index.html file.
Try to disable cache for index.html like this:
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
Or if you are using a .htaccess file, add this code to the bottom of the file:
<Files index.html>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</Files>

Magento Rest API retuning 404 for products page

I've installed / configured Magento 1.9. CE on my local Ubuntu 14 machine by following the guide at https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-magento-on-ubuntu-14-04. I've setup my Magento base as http://localhost.
I then tried accessing the APIs from Java using Scribe. This is the code I have right now:
public final class MagentoAuth {
/**
* #param args
*/
public static void main(String[] args) {
final String MAGENTO_API_KEY = "abc";
final String MAGENTO_API_SECRET = "xyz";
final String MAGENTO_REST_API_URL = "http://localhost/api/rest";
// three-legged oauth
OAuthService service = new ServiceBuilder()
.provider(MagentoThreeLeggedOAuth.class)
.apiKey(MAGENTO_API_KEY)
.apiSecret(MAGENTO_API_SECRET)
.debug()
.build();
System.out.println("" + service.getVersion());
Scanner in = new Scanner(System.in);
System.out.println("Magento's OAuth Workflow");
System.out.println();
// Obtain the Request Token
System.out.println("Fetching the Request Token...");
Token requestToken = service.getRequestToken();
System.out.println("Got the Request Token!");
System.out.println();
System.out.println("Fetching the Authorization URL...");
String authorizationUrl = service.getAuthorizationUrl(requestToken);
System.out.println("Got the Authorization URL!");
System.out.println("Now go and authorize Main here:");
System.out.println(authorizationUrl);
System.out.println("And paste the authorization code here");
System.out.print(">>");
Verifier verifier = new Verifier(in.nextLine());
System.out.println();
System.out.println("Trading the Request Token for an Access Token...");
Token accessToken = service.getAccessToken(requestToken, verifier);
System.out.println("Got the Access Token!");
System.out.println("(if your curious it looks like this: "
+ accessToken + " )");
System.out.println();
OAuthRequest request = new OAuthRequest(Verb.GET, MAGENTO_REST_API_URL+ "/products?limit=2");
service.signRequest(accessToken, request);
Response response = request.send();
System.out.println();
System.out.println(response.getCode());
System.out.println(response.getBody());
System.out.println();
}
}
When I run this program, I'm able to successfully get the token, which I then verify from the Magento Admin panel. But then when I paste the token, I get the following error:
404
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /api/rest/products was not found on this server.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address>
</body></html>
Now, I saw on many forums that adding a block to their Apache conf file worked. I have the following in my conf file (/etc/apache2/sites-available/magento.conf):
<VirtualHost *:80>
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
</VirtualHost>
However, I was not sure if that is the place to add. So I also added the <Directory> block in my apache.conf file (/etc/apache2/apache.conf) as well and restarted apache2 server. However, this doesn't help me either. I still get the 404 error. What am I doing wrong here?
Not sure if this has anything to do with the problem ,but I added the sample data provided on Magento's website after installing Magento (even though they have specifically mentioned not to do so) because of which all my default data such as admin user etc were deleted from the database. So I had to add the admin user manually myself in the database. Would this have changed something else?
======================== EDIT ===========================
I edited my .htaccess file and added the following:
## you can put here your magento root folder
## path relative to web root
RewriteBase /var/www/html/
Now, when I try to run my code, it fails even before getting the token with this error:
response status code: 403
response body: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /var/www/html/index.php
on this server.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address>
</body></html>
Thanks.
Make sure to use Options -MultiViews

Error (JSON 404): <!DOCTYPE HTML PUBLIC "-//IETF/

When I run "vmc info", I get an error : Error (JSON 404):
cloud#rest:~/cloudfoundry/.deployments/rest/log$ vmc info -t
>>>
REQUEST: get http://api.mwt.needforspeed.info/info
RESPONSE_HEADERS:
content_length : 239
date : Thu, 11 Oct 2012 07:32:17 GMT
content_type : text/html; charset=iso-8859-1
content_encoding : gzip
server : Apache/2.2.22 (Ubuntu)
vary : Accept-Encoding
RESPONSE: [404]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /info was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at api.mwt.needforspeed.info Port 80</address>
</body></html>
<<<
Error (JSON 404): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /info was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at api.mwt.needforspeed.info Port 80</address>
</body></html>
It looks like you have apache webserver running on port 80.
If you install cloudfoundry to a plain vanilla Ubuntu, it will install nginx as a webserver.
So first stop your apache, normally with:
sudo /etc/init.d/apache2 stop
and than check that your nginx (router in cloudfoundry's term) is running:
source ~/.cloudfoundry_deployment_local
~/cloudfoundry/vcap/dev_setup/bin/vcap_dev -n rest status router
please note that you need the extra -n rest parameter as it seems that you didn't use the default development name: dev_box