apache

关于base64编码Encode和Decode编码的几种方式

情到浓时终转凉″ 提交于 2021-02-11 20:53:22
关于base64编码Encode和Decode编码的几种方式 Base64是一种能将任意Binary资料用64种字元组合成字串的方法,而这个Binary资料和字串资料彼此之间是可以互相转换的,十分方便。在实际应用上,Base64除了能将Binary资料可视化之外,也常用来表示字串加密过后的内容。如果要使用Java 程式语言来实作Base64的编码与解码功能,可以参考本篇文章的作法。 早期作法 早期在Java上做Base64的编码与解码,会使用到JDK里sun.misc套件下的BASE64Encoder和BASE64Decoder这两个类别,用法如下: final BASE64Encoder encoder = new BASE64Encoder(); final BASE64Decoder decoder = new BASE64Decoder(); final String text = "字串文字"; final byte[] textByte = text.getBytes( "UTF-8"); //编码 final String encodedText = encoder.encode(textByte); System.out.println(encodedText); //解码 System.out.println( new String(decoder

用nodejs搭建代理服务器

邮差的信 提交于 2021-02-11 20:34:35
题图 From 极客时间 From Clm 前端开发者在工作中常常遇到跨域的问题,一般我们遇到跨域问题主要使用以下办法来解决: 1、jsonp 2、cors 3、配置代理服务器。 jsonp不是很灵活,只能发送get请求,不能发送psot请求,而cors虽然可以支持多种请求格式,但是如果请求携带cookie的话,还需要服务端和客户端分别配置一下,个人感觉也很麻烦。 相对于前两种,使用代理服务器解决跨域问题就简单了好多。 浏览器由于同源策略的原因,不同域名之间发送ajax请求,响应的数据不会被浏览器加载。而服务器向服务器发送请求则没有同源策略的限制。 下图便是代理服务器的原理了: 代理服务器只是起一个中转作用,配置代理服务器的方法有很多种,比如利用apache、nginx、tomcat等等,今天给大家介绍的是用nodejs配置代理服务器,用nodejs配置代理服务器,我们需要借助两个npm包,一个是web开发框架 express ,一个是express中间件 http-proxy-middleware 。 首先第一步我们先用express搭建两个服务器,一个静态资源服务器端口号为3000,一个接口服务器端口号为5000,静态资源服务器代码如下: var express = require ( 'express' ); var app = express(); app.use

Apache HTTPD: How to setup Virtual Host correctly

夙愿已清 提交于 2021-02-11 18:23:55
问题 I've installed Apache httpd on my Mac and "It works". Now I need to configure a Virtual Host in order to expose my application (Java Spring) with httpd as reverse proxy in front of it. This is what I have into /usr/local/etc/httpd/extra/httpd-vhosts.conf file <VirtualHost *:443> ServerName my.domain.it:443 SSLEngine on SSLCertificateFile /path/to/cert.crt SSLCertificateKeyFile /path/to/cert.key ProxyPreserveHost On ProxyPass / http://localhost:8080/myapp ProxyPassReverse / http://localhost

redirect wordpress child pages to their parent page

久未见 提交于 2021-02-11 18:03:10
问题 I have a glossary page in my site with child pages like this: http://my-domain.com/glossay/a/ http://my-domain.com/glossay/b/ http://my-domain.com/glossay/c/ ... & every item in glossary has it's own child page based on alphabet like this: http://my-domain.com/glossay/a/abandon/ http://my-domain.com/glossay/a/art/ http://my-domain.com/glossay/b/bee/ ... I need a redirection rule to redirect users from items child page, to their parent page based on their first word. for example: http://my

Remove folder name from URL

安稳与你 提交于 2021-02-11 18:02:17
问题 I have a domain www.domain.com redirected to / in my server. Next I have index.php whith code: header("Location: http://domain.com/v3/"); When I enter mydomain.com I have mydomain.com/v3/ in url. How to remove v3 from Url 回答1: Remove header line from your PHP code since it is doing a redirect and have this lookahead based rule in your root .htaccess : RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+v3/([^?\s]*) [NC] RewriteRule ^ /%1 [R=302,L,NE] RewriteRule ^((?!v3/).*)$ /v3/$1 [L

PHP Windows extensions won´t load

自古美人都是妖i 提交于 2021-02-11 16:46:43
问题 I'm working on a windows server 2008 R2 machine. I have installed apache 2.2 with php 5.4.25 While trying to enable ldap support for the apache server i found out that the server does not load the extensions. I ran php_info() and this was the result Configuration File (php.ini) Path C:\Windows Loaded configuration file: "C:\php\php.ini extension_dir C:\php\ext I have changed the php.ini to load the extensions, but they are not loaded and they are not visible in the php_info dump. I tried to

PHP Windows extensions won´t load

蹲街弑〆低调 提交于 2021-02-11 16:45:14
问题 I'm working on a windows server 2008 R2 machine. I have installed apache 2.2 with php 5.4.25 While trying to enable ldap support for the apache server i found out that the server does not load the extensions. I ran php_info() and this was the result Configuration File (php.ini) Path C:\Windows Loaded configuration file: "C:\php\php.ini extension_dir C:\php\ext I have changed the php.ini to load the extensions, but they are not loaded and they are not visible in the php_info dump. I tried to

Change HttpTransportFactory cxf 2.7.3

♀尐吖头ヾ 提交于 2021-02-11 15:40:57
问题 I'm trying to change the HttpURLConnection that the cxf HTTPTransportFactory uses. Cxf (version 2.7.3) uses HTTPTransportFactory for http/https request. The HTTPTransportFactory uses Conduit of type URLConnectionHTTPConduit . URLConnectionHTTPConduit has method: createConnection which returns HttpURLConnection . I need to replace HttpURLConnection with my own custom one, lets call it CustomHttpURLConnection . I managed to change the TransportFactory that cxf uses by: Creating class that

htaccess redirecting specific URL to new domain

怎甘沉沦 提交于 2021-02-11 15:30:49
问题 I'm getting myself seriously confused with Rewrite Conditions and Rewrite Rules in my htaccess file. Basically I have a new domain and want to redirect my articles to the new domain. For instance in someone visits old-domain.com/article/XYZ-article-title I want it to redirect to new-domain.com/article/XYZ-article-title. Where I'm getting myself confused is that I only want it to redirect if /article is in the domain (the old domain is still in use for other stuff). 回答1: You can use this code

htaccess redirecting specific URL to new domain

江枫思渺然 提交于 2021-02-11 15:29:45
问题 I'm getting myself seriously confused with Rewrite Conditions and Rewrite Rules in my htaccess file. Basically I have a new domain and want to redirect my articles to the new domain. For instance in someone visits old-domain.com/article/XYZ-article-title I want it to redirect to new-domain.com/article/XYZ-article-title. Where I'm getting myself confused is that I only want it to redirect if /article is in the domain (the old domain is still in use for other stuff). 回答1: You can use this code